Presentation is loading. Please wait.

Presentation is loading. Please wait.

AOP/cross-cutting What is an aspect?. An aspect is a modular unit that cross-cuts other modular units. What means cross-cutting? Apply AOP to AOP. Tease.

Similar presentations


Presentation on theme: "AOP/cross-cutting What is an aspect?. An aspect is a modular unit that cross-cuts other modular units. What means cross-cutting? Apply AOP to AOP. Tease."— Presentation transcript:

1 AOP/cross-cutting What is an aspect?

2 An aspect is a modular unit that cross-cuts other modular units. What means cross-cutting? Apply AOP to AOP. Tease an aspect apart into three units: ideal graph, labels on nodes and edges of ideal graph, application to concrete graph using connectors: specifies cross-cutting

3 What is an aspect? An aspect is a modular unit that cross-cuts other modular units. Example: MU 1: application code, MU 2: class library code. Application code uses names from class library. Cross-cutting. MU 1 is an aspect! Not reasonable What is missing?

4 What is an aspect? An aspect is a modular unit that cross-cuts and enhances other modular units. Previous example now ruled out. Example: MU 1: APPC, MU 2: class graph. Cross-cutting is indirect through a connector. APPC is an aspect

5 Alternative definition An aspect –is a modular unit that has no stand-alone function and –that affects other modular units Stand-alone = requiring context in order to function

6 Other definition (Xerox PARC) Implement properties. Some are implemented by generalized procedures. Those that are not implemented by generalized procedures are called aspects. Aspects are defined modulo programming language and a set of components

7 Terminology Building block = BB Participants (classes at basic level) = BB of type 1 APPC = BB of type 2 = consisting of set of generic BB of type 1. Connectors = map generic BB = implements cross-cutting

8 AOP components = building blocks type 1 whatever does not fit into one building block of type 1 is expressed as one building block type 2 that consists of a set of generic building blocks of type 1. generic building blocks of a building block of type 2 are mapped to building blocks of type 1.

9 Generic BB A building block with holes

10 AOP Properties of mapping –one generic building block is mapped to one or more building blocks –building blocks may have parts. One part of generic building block is mapped to one or more parts of corresponding generic building block.

11 Example: APPCs Ideal graph: participant graph Labels on nodes and edges: participant code Concrete graph: participant graph or application class graph Connectors specify cross-cutting

12 Something missing in APPCs Components, connectors Components –provided, required interface –required interface includes participant graph –participant code –also needs help from other components that are connected to local participants

13 Improved APPCs Components –provided, required interface –required interface includes participant graph –participant code –list of imported components –connectors

14 Pricing Logging LoggingPricing Interface of Pricing becomes interface of LoggingPricing Summing

15 Counting Locking CountingLocking Interface of Counting becomes interface of CountingLocking

16 Visitors and components? component Summing { participant Source { Target t; int sum() {cg.traverse(this, new Strategy(“from Source to Target”), new Visitor{ int sum s; start(){s=0;}; void before(Target host){ s+=host.what;} } participant Target { public int what;} }

17 Example Have component for Pricing Want to log instance creation of three participant classes. Use Logging component and connect to three participants

18 Cross-cutting Does not only mean inserting aspect code into enhanced unit. There is interaction between aspect code and modified unit code. Some aspects can change structure of modified unit others just insert additional code into old structure

19 Theory of cross cutting Model programs as graphs (e.g. class diagrams, abstract syntax trees, etc.) Aspects: model as graph editing instructions modeled with respect to an ideal graph. Graph editing: add new nodes and edges and add to node labels and edge labels

20 Specifying cross-cutting Uniform: node to nodes, edge to edges: simple weaving –explicit: {A,B,C,D} –succinct: Nodes(Graph(“From A to D”)) Non-uniform: edge to multiple edges: code is different from target edge to target edge

21 Specifying cross-cutting mapping With traversal. From A to B: B mapped to multiple targets Without traversal. Two classes A and B with some connection? Without traversal is an uninteresting special case? Name map is the cross-cutting.

22 Use of traversal strategies to specify cross-cutting in AOP Set of classes: Nodes(strategy) Graph refinement: map participant graph


Download ppt "AOP/cross-cutting What is an aspect?. An aspect is a modular unit that cross-cuts other modular units. What means cross-cutting? Apply AOP to AOP. Tease."

Similar presentations


Ads by Google