1 / 22

AOP/cross-cutting

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

osborn
Download Presentation

AOP/cross-cutting

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. AOP/cross-cutting What is an aspect?

  2. 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 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. Stand-alone = requiring context in order to function Alternative definition • An aspect • is a modular unit that has no stand-alone function and • that affects other modular units

  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. LoggingPricing Interface of Pricing becomes interface of LoggingPricing Logging Pricing Summing

  15. CountingLocking Interface of Counting becomes interface of CountingLocking Locking Counting

  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-cuttingmapping • 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 strategiesto specify cross-cutting in AOP • Set of classes: Nodes(strategy) • Graph refinement: map participant graph

More Related