210 likes | 224 Views
AP Book View of AOP. AP Book = Adaptive Object-Oriented Software Development, published August 1995 by PWS. AP Book Definition. Definition of AOP: "Adaptive software is specified in terms of complementary, collaborating views, each one addressing a different concern of the application.".
E N D
AP Book View of AOP AP Book = Adaptive Object-Oriented Software Development, published August 1995 by PWS. Early AOP definition
AP Book Definition • Definition of AOP: "Adaptive software is specified in terms of complementary, collaborating views, each one addressing a different concern of the application." Early AOP definition
AP Book Definition • What does “collaborating views” mean: For the special case of two views V1 and V2: "An element v1 of V1 is formulated in terms of partial information about elements of V2." Early AOP definition
AP Book Definition • Comments: • The Xerox PARC definition distinguishes components and aspects. • We call both components and aspects views. A component is considered a “behavioral view”. Early AOP definition
AP Book Definition • Comments: • The Xerox PARC definition of AOP stresses the importance of “cross-cutting”. • The word "cross-cut" does not show up here but it is implied: The partial information used from one view V may be spread out all over V. Early AOP definition
Cross-cutting in AOP v2 in V2 Partial Information v1 in V1 The partial information of v2 referred to in v1 is spread in v2. v1 adds to v2. Early AOP definition
Careful Formulation Formulated for a family of views called V2. • "An element v1 of V1 is formulated in terms of partial information about elements of V2." Early AOP definition
Example: Write accesses • Example from AspectJ tutorial. • Show write accesses Early AOP definition
View v2 = component Example: Write accesses class Point { int _x = 0; int _y = 0; void set(int x, int y) { _x = x; _y = y; } void setX(int x) { _x = x; } void setY(int y) { _y = y; } int getX(){ return _x; } int getY(){ return _y; } } View v1 = aspect aspect ShowAccesses { staticbefore Point.set, Point.setX, Point.setY { System.out.println(“W”); } } Early AOP definition
Example: Bus Route • Adaptive Programming • Printing persons waiting at some bus stop in bus route Early AOP definition
Example: Bus Route v2 = Class graph View v1 = Adaptive program Early AOP definition
Adaptive Program BusRoute { traversalwaitingPersons(PersonVisitor) { through BusStop to Person; } // from is implicit int printWaitingPersons() // traversal/visitor weaving instr. = waitingPersons(PrintPersonVisitor); PrintPersonVisitor { before Person (@ … @) … } PersonVisitor {init (@ r = 0; @) … } Early AOP definition
find all persons waiting at any bus stop on a bus route Class Graph from BusRoute through BusStop to Person busStops BusRoute BusStopList buses 0..* BusStop BusList waiting 0..* passengers Bus PersonList Person 0..* Early AOP definition
find all persons waiting at any bus stop on a bus route Class Graph 2 from BusRoute through BusStop to Person villages BusRoute BusStopList buses VillageList busStops 0..* 0..* BusStop BusList Village waiting 0..* passengers Bus PersonList Person 0..* AOOP / Demeter
Indirect access to partial information • The formulation of a view in terms of partial information may be indirect. Early AOP definition
Indirect access to partial information Early AOP definition
AP Example A B From A to * E D C Early AOP definition
AOP example with APPCs class Point { int _x = 0; int _y = 0; void set(int x, int y) { _x = x; _y = y; } void setX(int x) { _x = x; } void setY(int y) { _y = y; } int getX(){ return _x; } int getY(){ return _y; } } appc ShowWAccesses { expected { Data-To-Access{* write-op(*);} } provided{ Data-To-Access { before write-op { System.out.println(“W”); } } connector connector AddShowWAccesses { connects appl, ShowWAccesses ... ShowAccesses.Data-To-Access { … write-op = set* ... } } Early AOP definition
AOP example 2 with APPCs P3 P2 m m 1,k 1,1 Application participant-to-class name map Interface Class Graph Structure expected interface map P1 link-to-paths map Behavior Definition main-entry P1 ... adaptive compiler (CG-to-ICG compatability?) executable Java code Early AOP definition
AOP example 2 with APPCs P3 P2 m m 1,k 1,1 Application participant-to-class name map Interface Class Graph Structure expected interface map P1 link-to-paths map Behavior Definition main-entry P1 ... adaptive compiler (CG-to-ICG compatability?) executable Java code Early AOP definition
End Early AOP definition