Aspect Weaving with Graph Rewriting - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Aspect Weaving with Graph Rewriting

Description:

Weavers can become as complicated as. fully fledged compilers. GCSE 99. 28-30. Sept 1999 ... 1) We need a uniform and formal technique to. classify and specify ... – PowerPoint PPT presentation

Number of Views:78
Avg rating:3.0/5.0
Slides: 23
Provided by: Lud46
Category:

less

Transcript and Presenter's Notes

Title: Aspect Weaving with Graph Rewriting


1
Aspect Weaving with Graph Rewriting
  • Uwe Aßmann
  • Andreas Ludwig
  • Universität Karlsruhe
  • Institut für Programmstrukturen

2
Overview
  • Aspect Oriented Programming (AOP)
  • Graph Rewrite Systems (GRS)
  • Categories of GRS-based Weaving
  • Generation of Aspect Weavers
  • Conclusion

3
Aspect-Oriented Programming
  • Motivation Separation of Concerns
  • Technique Integration by Weaving
  • Examples for Aspects
  • Synchronization
  • Communication
  • Instrumentalization

4
Problem
  • AOP aims at different problem domains...
  • ... weaving requires different techniques.
  • Weavers can become as complicated as
  • fully fledged compilers.

5
Idea
  • 1) We need a uniform and formal technique to
  • classify and specify AOP weavers.
  • 2) Programs are edge-colored graphs...
  • Describe aspect weaving as graph-rewriting.

6
Classes of AOP Systems
  • Script-based AOP (e.g. RG )
  • aspects are modification rules
  • Language-based AOP (e.g. AspectJ )
  • aspects are specialized languages
  • Rewriting-based AOP
  • rewriting rules combine aspect fragments

7
GRS - Basics
Rewrite Rule
Derivation
Host Graph
Redex
8
Component Aspect Graphs
9
AOP as GRS
  • Join Point ? Redex in Component Graph
  • Aspect Fragment ? Redex in Aspect Graph
  • Aspect Composer ? Graph Rewrite Rule
  • Weave Operation ? Direct Derivation
  • Weaver ? Graph Rewrite System with
  • a set of aspect composers,
  • a component graph, and
  • a set of aspect graphs (context-sensitive rules).

10
Example
  • Task prepend statements to method entries

class ClassDeclaration (nameName)
class ClassDeclaration (nameName)
aspectStatement Statement (placename)
aspectStatement Statement (placename)
methods
methods
method MethodDeclaration
method MethodDeclaration
entry
11
Example (2)
methods
entry
methods
methods
entry
methods
methods
12
Benefits
  • Uniform specification allows a classification of
    aspect weaving systems.
  • Certain classes of rewrite systems guarantee
  • termination
  • confluence ( deterministic results)

13
Category I Aspect-Relating Rules
  • Edge-addition rewrite system (EARS)
  • always congruent ( terminating confluent)
  • weaving operation becomes a function
  • Ideal for simple property aspects
  • e.g. persistency, synchronization, ...

14
Category IIAspect-Additive Rules
  • Exhaustive rewriting system (XGRS)
  • does not modify the redex
  • always congruent ( terminating confluent)
  • Ideal for orthogonal aspect code
  • e.g. Adaptive Programming

15
Category IIIComponent-Modifying Rules
  • Exchange parts of components.
  • Confluence and termination are not guaranteed.
  • Indeterminism is acceptable if all normal forms
    are semantically equivalent.

16
Special CategoryAspects in Rules
  • Aspect fragments are part of the right-hand
    sides.
  • Similar to script-based AOP.
  • Ideal for aspects with finite variability.

17
Special CategoryComponent-Modifying Rules
  • Intra-component rules
  • rewrite the component graph only
  • resemble standard code motion optimizations
  • Ideal for optimizing aspect weavers.
  • e.g. RG

18
Comparison
System
terminating
deterministic
aspect graph
Aspect Fragment Matching
Aspect-relating
yes
yes
yes
Aspect-additive
if exhaustive
yes
yes
Component-modifying
if exhaustive
usually not
yes
Aspects in Rules
depends
depends
no
Intra-Component
depends
depends
no
19
Aspect Weaving is similar toProgram Optimization
  • Graph rewriting can express many program
    optimizations uniformly Aßm96.
  • Optimizations transform programs.
  • Weavers transform programs.
  • Claim
  • Graph rewriting can express many aspect weavings
    uniformly.

20
Generating Tools from Rewrite Specification
Program data weaving rules
Optimix
Component Code
generates
Weaver
Aspect Code
generates
Program
21
Conclusion
  • GRS provide a uniform and formal way to specify
    and classify aspect weavings.
  • Tool support for weavers.
  • Open question
  • How much of AOP can be covered by this approach?

22
Rewriting or Meta-Programming
  • Graph-rewriting rules are declarative.
  • The component and aspect graphs are
    (meta-)models of the program.
  • The derivations can also be implemented
    explicitely by meta-programming.
Write a Comment
User Comments (0)
About PowerShow.com