14
Aspect-Oriented Software Development (236608) 1 Aspect-Oriented Software Development (AOSD) Tutorial #1 Course site : http://webcourse.cs.technion.ac.il/236608/ Winter2007-2008/ T.A. : Emilia Katz [email protected] Reception hours: Sunday 17:00 – 18:00 Taub 641

Aspect-Oriented Software Development (AOSD) Tutorial #1

Embed Size (px)

DESCRIPTION

Aspect-Oriented Software Development (AOSD) Tutorial #1. Course site : http://webcourse.cs.technion.ac.il/236608/Winter2007-2008/ T.A. :Emilia Katz [email protected] Reception hours: Sunday 17:00 – 18:00 Taub 641. - PowerPoint PPT Presentation

Citation preview

Page 1: Aspect-Oriented Software Development (AOSD) Tutorial #1

Aspect-Oriented Software Development (236608)

1

Aspect-Oriented Software Development (AOSD)

Tutorial #1

Course site : http://webcourse.cs.technion.ac.il/236608/Winter2007-2008/

T.A. : Emilia Katz

[email protected]

Reception hours: Sunday 17:00 – 18:00

Taub 641

Page 2: Aspect-Oriented Software Development (AOSD) Tutorial #1

Aspect-Oriented Software Development (236608)

2

Tutorial 1: Why aspects?

We will see:

• Example system

• Illustration of tangling and scattering

Page 3: Aspect-Oriented Software Development (AOSD) Tutorial #1

Aspect-Oriented Software Development (236608)

3

General Remarks

Facts about aspects:• Aspects can be identified at different stages of

the development cycle• Ideally: “Low impact (non-invasiveness) of

changes” Additive changes in requirements additive

change in design and code.• Tangling and scattering reduce reusability and

traceability, and changes become invasive

Page 4: Aspect-Oriented Software Development (AOSD) Tutorial #1

Aspect-Oriented Software Development (236608)

4

Example : SEESoftware Engineering Environment for

programs consisting of expressionsDescription:• Supports specification of expression

programs• Contains set of tools for expressions:

– evaluation– display– check (syntactic & semantic correctness)

Page 5: Aspect-Oriented Software Development (AOSD) Tutorial #1

Aspect-Oriented Software Development (236608)

5

Example : SEE – contd.

Development process (simplified):

Requirements (in natural language)

Design (UML)

Implementation (Java)

decompose by tool

decompose by object

Intuition: difference in decompositions causesscattering and tangling!

Page 6: Aspect-Oriented Software Development (AOSD) Tutorial #1

Aspect-Oriented Software Development (236608)

6

Design for SEE (partial)expression

number…

binary operator…

unary operator…

plus…

minus…

unary plus…

unary minus…

access/modify

apply tools

create() getters setters

eval() display() check()

Page 7: Aspect-Oriented Software Development (AOSD) Tutorial #1

Aspect-Oriented Software Development (236608)

7

New Requirements for SEE

• Persistence: expressions should be optionally persistent

• Style check support: it should be possible to check expressions against multiple styles (fonts, naming conventions, etc.)

Page 8: Aspect-Oriented Software Development (AOSD) Tutorial #1

Aspect-Oriented Software Development (236608)

8

Adding Persistenceexpression

number…

binary operator…

unary operator…

plus…

minus…

unary plus…

unary minus…

access/modify

apply tools

save

- retrieve persistent objects on first access

- flush modifications back to database

scattering

tangling

Page 9: Aspect-Oriented Software Development (AOSD) Tutorial #1

Aspect-Oriented Software Development (236608)

9

Adding Style Checksexpression

number…

binary operator…

unary operator…

plus…

minus…

unary plus…

unary minus…

access/modify

apply tools

let 3 style checkers be defined

visitor

ch. 1 ch. 2 ch. 3accept(visitor)

affect display() method

instead of check() method

Page 10: Aspect-Oriented Software Development (AOSD) Tutorial #1

Aspect-Oriented Software Development (236608)

10

Style Checks + Persistanceexpression

number…

binary operator…

unary operator…

plus…

minus…

unary plus…

unary minus…

access/modify

apply tools

save

persistence of style-checkers state information

accept(visitor)

visitor

ch. 1 ch. 2 ch. 3

Page 11: Aspect-Oriented Software Development (AOSD) Tutorial #1

Aspect-Oriented Software Development (236608)

11

Adding Persistence as Aspectexpression

number…

binary operator…

unary operator…

plus…

minus…

unary plus…

unary minus…

access/modify

apply tools

persistence asp.

pointcut definition

advice()

save() retrieve()

flush()

Page 12: Aspect-Oriented Software Development (AOSD) Tutorial #1

Aspect-Oriented Software Development (236608)

12

Crosscutting More than one Hierarchy

Example - system for exams in arithmeticInitially, includes exams: • Questions: each question is an expression• Answers: each answer is a number• Grade: grade is calculated based on answers

checks (use the “eval()” function of the questions, check equality with the answers, count correct answers percentage)

Addition: Persistency of the exams (the whole history)!

Page 13: Aspect-Oriented Software Development (AOSD) Tutorial #1

Aspect-Oriented Software Development (236608)

13

Adding Persistency - Results

Crosscutting more than one class hierarchy?

• Expressions (Questions)?

• Answers?

• Grades?

• Exam class?

Yes!

Crosscutting more than one class hierarchy!

Page 14: Aspect-Oriented Software Development (AOSD) Tutorial #1

Aspect-Oriented Software Development (236608)

14

Adding Persistency - Treatment

Without aspects – changes in: • Expressions (Questions)• Answers• Grades• Exam as a wholeWith aspects – Reuse persistency aspect, with changes in:• Pointcut definition [on what classes to be applied, …]• Additional aspect advice (may be unnecessary)