1 / 71

A Calculus of Untyped Aspect-Oriented Programs

This paper introduces a calculus for untyped aspect-oriented programs, describing the syntax, reduction rules, and correctness of weaving aspects.

clarket
Download Presentation

A Calculus of Untyped Aspect-Oriented Programs

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. A Calculus of Untyped Aspect-Oriented Programs Paper by Radha Jagadeesan Alan Jeffrey James Riely Presented by Shay Cohen

  2. Contents • Introduction • A Class-based Language • Syntax • Reduction • An Aspect-based Language • Syntax • Reduction • Weaving • The Correctness of Weaving

  3. Aspects have emerged as a powerful tool For example: Introduction- example

  4. The intended execution semantics is as follows: a call to foo() invokes the code associated with the advice (the timer is started) foo() method is invoked when control reaches proceed() Upon termination of foo(), control returns to the advice Introduction- intended execution

  5. Introduction - Example publicaspect WeavingAspect { before (String s): execution(void go(*)) && args(s) { System.out.println("before (String s): execution(void go(*)) && args(s) " + s); } before (Object s): execution(void go(*)) && args(s) { System.out.println("before (Object s): execution(void go(*)) && args(s) " + s); } }

  6. Introduction- Problem publicclass WeavingObject { publicstaticvoid main(String[] args) { WeavingObject obj = new WeavingObject(); String s = null; obj.go(s); System.out.println(); s = new String("String"); obj.go(s); } publicvoid go(Object s) { System.out.println("go(Object s) " + s); } } before (Object s): execution(void go(*)) && args(s) null go(Object s) null before (String s): execution(void go(*)) && args(s) String before (Object s): execution(void go(*)) && args(s) String go(Object s) String

  7. Introduction- Conclusion • Knowing the aspects semantics is essential. • One cannot naively extend object-oriented reasoning to aspect-oriented programs.

  8. Introduction • Reductionismand a specification for weaving: • Advice looked as a primitive • Only around advice • No reflection • Focusing on dynamics • At the end correctness of the weaving transformation will be shown • Weavability will be defined to exclude programs that cannot be woven statically

  9. Contents • Introduction • A Class-based Language • Syntax • Reduction • An Aspect-based Language • Syntax • Reduction • Weaving • The Correctness of Weaving

  10. A Class-based Language - Program • Transformation of a program • A program Phas the form • is a set of declarations • is a set of heap allocated threads and objects.

  11. A Class-based Language – class, thread (table 1) • Superclass d • A set of method declarations • Controlling object p • Stack S

  12. A Class-based Language – object (table 1) • Actual class of the object • Value of fields

  13. A Class-based Language – Syntax (table 1)

  14. A Class-based Language cont. • Method calls may be dispatched • dynamic type • static type

  15. Contents • Introduction • A Class-based Language • Syntax • Reduction • An Aspect-based Language • Syntax • Reduction • Weaving • The Correctness of Weaving

  16. A Class-based Language – Reduction • Reduction proceeds via a standard substitution of parameters

  17. A Class-based Language –Reduction example

  18. A Class-based Language –Dynamic message (table 2)

  19. A Class-based Language –Value (table 2)

  20. A Class-based Language –Get (table 2)

  21. A Class-based Language – Set (table 2)

  22. A Class-based Language –Return (table 2)

  23. A Class-based Language -Reduction

  24. A Class-based Language – This, Super (table 2)

  25. A Class-based Language – Reduction summary

  26. Contents • Introduction • A Class-based Language • Syntax • Reduction • An Aspect-based Language • Syntax • Reduction • Weaving • The Correctness of Weaving

  27. An Aspect-based Language – Example Advised message

  28. An Aspect-based Language – Aspect declaration (table 3) • Aspect declaration • Name – allows reference • Command sequence – what to execute • Pointcut – when to execute • pointcuts are presented as elements of the Boolean algebra

  29. An Aspect-based Language – Advice (table 3) • Advised method call • Call advice set • Execution advice set • Advice body new command

  30. An Aspect-based Language – method (table 3) • Dynamically dispatched method changed • We now have the static type as well • Static type is needed for call advice • We ignore call advice for super calls

  31. An Aspect-based Language – Advice creation • Given a method definition • methods in the aspect calculus do not have any method bodies:

  32. An Aspect-based Language – Aspect based syntax (table 3)

  33. An Aspect-based Language – Semantics of pointcuts (table 4)

  34. An Aspect-based Language – Semantics of pointcuts (table 4)

  35. An Aspect-based Language – Semantics of pointcuts (table 4)

  36. An Aspect-based Language – Semantics of pointcuts (table 4)

  37. Questions? Questions? Questions?

  38. Contents • Introduction • A Class-based Language • Syntax • Reduction • An Aspect-based Language • Syntax • Reduction • Weaving • The Correctness of Weaving

  39. An Aspect-based Language – Reduction example

  40. An Aspect-based Language – Dynamic message (table 5)

  41. An Aspect-based Language – Advice message (call) (table 5)

  42. An Aspect-based Language – Advice message (execution) (table 5)

  43. An Aspect-based Language – Reduction

  44. An Aspect-based Language – Aspect based Reduction (table 5)

  45. An Aspect-based Language – Reduction summary

  46. An Aspect-based Language – Coherence • advice that appears in a method declaration must be consistent with that which is attached to a pointcut

  47. An Aspect-based Language – Close

  48. An Aspect-based Language – Lemma Note that any program where each class declaration is taken from the class-based language is semi-coherent by construction.

  49. Contents • Introduction • A Class-based Language • Syntax • Reduction • An Aspect-based Language • Syntax • Reduction • Weaving • The Correctness of Weaving

  50. Weaving – Requirements • Correctness is formalized by demanding that the following diagram can be completed • We also expect that a woven program not have spurious new reductions.

More Related