Your SlideShare is downloading. ×
Machine-level Composition of Modularized Crosscutting Concerns <ul><ul><li>Hans Schippers </li></ul></ul><ul><ul><li>Unive...
Special Thanks To... <ul><ul><li>Michael Haupt </li></ul></ul><ul><ul><li>Robert Hirschfeld </li></ul></ul><ul><ul><li>Sof...
Agenda <ul><li>Context </li></ul><ul><ul><li>Modularization </li></ul></ul><ul><ul><li>Crosscutting Concerns </li></ul></u...
Modularization <ul><li>Divide and Conquer </li></ul><ul><li>Organize a Software System in Manageable Modules </li></ul><ul...
Employee Management System Task 1 Find Out Employee-Boss Relationships Sales Research Financial Support
Employee Management System Task 2 Calculate Salaries ? Sales Research Financial Support
Employee Management System Task 2 Calculate Salaries Research Monthly Hourly Bonus
Employee Management System Task 1 Find Out Employee-Boss Relationships ? Research Monthly Hourly Bonus
Dominant Decomposition: Organizational Hard to calculate salary... Easy to find out supervisor  relationships... Employee ...
Dominant Decomposition: Payroll Easy to  calculate salary... Hard to find out supervisor relationships... Employee HourlyW...
Crosscutting Concerns source: http://www.ercim.org/publication/Ercim_News/enw58/van_deursen1.jpg  Column: Module Each Colo...
Modularizing Crosscutting Concerns MDSOC  approaches  deal with the  modularization of  crosscutting concerns . tangling /...
State-of-the-Art: Weaving... <ul><li>Source Code Level </li></ul><ul><li>[EAOP] </li></ul><ul><li>Byte Code Level </li></u...
I've Got Troubles, Oh-Oh Ik Heb Zorgen <ul><li>Manageability: Lose Track of Modules </li></ul><ul><li>Performance: Residua...
Core Mechanisms <ul><li>a different look at join points </li></ul><ul><ul><li>at each join point, decisions are drawn </li...
A Dedicated Machine Model <ul><li>core concepts: objects and delegation  [ECOOP 07] </li></ul><ul><ul><li>each application...
Basic Modularization Operations // CaesarJ-like pseudo code class C { void f() { ... } void g() { ... } void h() { ... } }...
Instance-Local Deployment // CaesarJ-like pseudo code class C { void f() { ... } void g() { ... } void h() { ... } } class...
Thread-Local Deployment // CaesarJ-like pseudo code class C { void f() { ... } void g() { ... } void h() { ... } } class A...
cflow: Continuous Weaving // CaesarJ-like pseudo code class C { void f() { ... } void g() { ... f(); ... } } class A { bef...
Introduction // CaesarJ-like pseudo code class C { int x; void f() { ... } } class A { int C.y; void C.g() { ... } before(...
Agenda <ul><li>Context </li></ul><ul><ul><li>Modularization </li></ul></ul><ul><ul><li>Crosscutting Concerns </li></ul></u...
j  – Object-Oriented Programming  [Skipper04] class Subject  ext Object   { Integer attr Observer obs void doSomething(Obj...
j  Prepared Heap Subject_prototype attr obs Subject_proxy Subject doSomething  = (...) changed = (...) setObserver = (...)...
j  Class Instantiation doSomething Subject_prototype attr obs Subject_proxy Subject doSomething  = (...) changed = (...) s...
ij  – Inter-Type Declarations  [Skipper04] class Observer ext Object { void update(Subject x) { out.println(x.attr) } Subj...
ij  Prepared Heap Subject_proto attr Subject_proxy Subject doSomething  = (...) Main_proto s o Main_proxy Main main  = (.....
ij  Class Instantiation obs Subject_proto attr Subject_proxy Subject doSomething  = (...) Main_proto s o Main_proxy Main m...
aj  – Pointcut and Advice AOP  [Skipper04] class Subject ext Object { Integer attr void changed(Object x) { out.println(th...
aj  Prepared Heap setAttr attr Subject_proto attr Subject_proxy Subject setAttr = (... self attr ...) changed = (...) Main...
cj  – Context-Oriented Programming class Subject  ext Object   { Integer attr void Subject.setAttr(Integer x){ this.attr :...
cj  Prepared Heap attr setAttr Subject_proto attr Subject_proxy Subject setAttr = (... self attr ...) changed = (...) Main...
Prototypical Implementation <ul><li>COLA Framework  [Piumarta  et al. ] </li></ul>
Experimental Implementation <ul><li>Implementation Substrate: VM Instructions </li></ul><ul><ul><li>(define-class ...) </l...
Onward! (Listen up, OOPSLA!) <ul><li>Additional Join Points (Pointcuts) </li></ul><ul><ul><li>history-based </li></ul></ul...
Summary <ul><li>Dedicated Machine Model </li></ul><ul><ul><li>Object-based + Delegation </li></ul></ul><ul><ul><li>Support...
Upcoming SlideShare
Loading in...5
×

Machine-level Composition of Modularized Crosscutting Concerns

218

Published on

PhD defense
Antwerp
20/11/2008

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
218
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Transcript of "Machine-level Composition of Modularized Crosscutting Concerns"

    1. 1. Machine-level Composition of Modularized Crosscutting Concerns <ul><ul><li>Hans Schippers </li></ul></ul><ul><ul><li>Universiteit Antwerpen </li></ul></ul><ul><ul><li>20 november 2008 </li></ul></ul>
    2. 2. Special Thanks To... <ul><ul><li>Michael Haupt </li></ul></ul><ul><ul><li>Robert Hirschfeld </li></ul></ul><ul><ul><li>Software Architecture Group </li></ul></ul><ul><ul><li>Hasso Plattner Institute, University of Potsdam </li></ul></ul><ul><ul><li>(close to Lindenstube...) </li></ul></ul>
    3. 3. Agenda <ul><li>Context </li></ul><ul><ul><li>Modularization </li></ul></ul><ul><ul><li>Crosscutting Concerns </li></ul></ul><ul><li>A Dedicated Machine Model </li></ul><ul><ul><li>Object-based + Delegation </li></ul></ul><ul><ul><li>Support for Modularization Mechanisms </li></ul></ul><ul><li>Language Mappings </li></ul><ul><ul><li>j : Object-Oriented Programming </li></ul></ul><ul><ul><li>ij : Inter-Type Declarations </li></ul></ul><ul><ul><li>aj : Pointcut-and-Advice AOP </li></ul></ul><ul><ul><li>cj : Context-Oriented Programming </li></ul></ul><ul><li>Future Work </li></ul>
    4. 4. Modularization <ul><li>Divide and Conquer </li></ul><ul><li>Organize a Software System in Manageable Modules </li></ul><ul><li>Each Module its own Responsibilities </li></ul>=> Which Modules? => How to Decompose the System?
    5. 5. Employee Management System Task 1 Find Out Employee-Boss Relationships Sales Research Financial Support
    6. 6. Employee Management System Task 2 Calculate Salaries ? Sales Research Financial Support
    7. 7. Employee Management System Task 2 Calculate Salaries Research Monthly Hourly Bonus
    8. 8. Employee Management System Task 1 Find Out Employee-Boss Relationships ? Research Monthly Hourly Bonus
    9. 9. Dominant Decomposition: Organizational Hard to calculate salary... Easy to find out supervisor relationships... Employee Research ResearchManager Sales SalesManager Financial FinancialManager Support SupportManager
    10. 10. Dominant Decomposition: Payroll Easy to calculate salary... Hard to find out supervisor relationships... Employee HourlyWage MonthlyWage Research Regular Sales SalesManager RegularManager Secretary Labourer ResearchManager
    11. 11. Crosscutting Concerns source: http://www.ercim.org/publication/Ercim_News/enw58/van_deursen1.jpg Column: Module Each Color: Task
    12. 12. Modularizing Crosscutting Concerns MDSOC approaches deal with the modularization of crosscutting concerns . tangling / scattering extra module (e.g., aspect, layer, ...) modularized code (e.g., advice, ...) join points Now somehow make all modules work together...
    13. 13. State-of-the-Art: Weaving... <ul><li>Source Code Level </li></ul><ul><li>[EAOP] </li></ul><ul><li>Byte Code Level </li></ul><ul><li>[AspectJ, Steamloom] </li></ul><ul><li>----- </li></ul><ul><li>Application Level </li></ul><ul><li>[EAOP, AspectJ] </li></ul><ul><li>Machine Level </li></ul><ul><li>[Steamloom] </li></ul>
    14. 14. I've Got Troubles, Oh-Oh Ik Heb Zorgen <ul><li>Manageability: Lose Track of Modules </li></ul><ul><li>Performance: Residual Code </li></ul><ul><ul><li>Modules may be active depending on dynamic conditions </li></ul></ul><ul><li>Elegance: Modularized Code --> OO Code </li></ul><ul><li>Conceptual: Join Points Misrepresented as Shadows </li></ul>We Need a Dedicated (Virtual) Machine
    15. 15. Core Mechanisms <ul><li>a different look at join points </li></ul><ul><ul><li>at each join point, decisions are drawn </li></ul></ul><ul><ul><li>which functionality to execute? </li></ul></ul><ul><ul><li>depends on context (current object, message sent/received, methods on stack, ...) </li></ul></ul><ul><li>very much like polymorphic dispatch </li></ul><ul><li>running application ≈ sequence of late binding events </li></ul><ul><ul><li>a join point is a locus of late binding </li></ul></ul><ul><ul><li>like virtual methods: virtual join points </li></ul></ul>
    16. 16. A Dedicated Machine Model <ul><li>core concepts: objects and delegation [ECOOP 07] </li></ul><ul><ul><li>each application object, internally, consists of two </li></ul></ul><ul><ul><li>a proxy (a mere placeholder ) and the actual object </li></ul></ul><ul><ul><li>other application objects only directly see the proxy </li></ul></ul><ul><ul><li>access to properties only via messages </li></ul></ul><ul><li>classes and instances </li></ul><ul><ul><li>classes are also represented by objects, also have a proxy </li></ul></ul><ul><ul><li>instances reference the proxy only </li></ul></ul><ul><ul><li>delegation ensures correct binding of self </li></ul></ul>self object actual-object foo = ( ... ) bar = 23 delegate instance-of-C actual-instance-of-C v = 23 C actual-C m = ( ... ) m
    17. 17. Basic Modularization Operations // CaesarJ-like pseudo code class C { void f() { ... } void g() { ... } void h() { ... } } class A { before(): execution(void C.f()) { ... } after(): execution(void C.g()) { ... } void around(): execution(void C.h()) { ... proceed(); ... } } ... deploy(new A()); ... actual-C f = ( ... ) g = ( ... ) h = ( ... ) C instance-of-C actual-instance-of-C A-proxy f = ( ...; resend ) g = ( resend; ... ) h = ( ...; resend; ... ) f
    18. 18. Instance-Local Deployment // CaesarJ-like pseudo code class C { void f() { ... } void g() { ... } void h() { ... } } class A { before(): execution(void C.f()) { ... } after(): execution(void C.g()) { ... } void around(): execution(void C.h()) { ... proceed(); ... } } ... deploy(new A(), instance-of-C); ... actual-C f = ( ... ) g = ( ... ) h = ( ... ) C instance-of-C actual-instance-of-C A-proxy f = ( ...; resend ) g = ( resend; ... ) h = ( ...; resend; ... )
    19. 19. Thread-Local Deployment // CaesarJ-like pseudo code class C { void f() { ... } void g() { ... } void h() { ... } } class A { before(): execution(void C.f()) { ... } after(): execution(void C.g()) { ... } void around(): execution(void C.h()) { ... proceed(); ... } } // in thread T1 ... deploy(new A()) { ... } ... actual-C f = ( ... ) g = ( ... ) h = ( ... ) C instance-of-C actual-instance-of-C A-proxy f = ( ...; resend ) g = ( resend; ... ) h = ( ...; resend; ... ) the delegate of C is a function of the thread T1 others
    20. 20. cflow: Continuous Weaving // CaesarJ-like pseudo code class C { void f() { ... } void g() { ... f(); ... } } class A { before(): execution(void C.f()) && cflow(execution(void C.g())) { ... } } ... deploy(new A()); ... actual-C f = ( ... ) g = ( ... f(); ... ) C instance-of-C actual-instance-of-C // in thread T1 ... instance-of-C.g(); ... T1 others A-cw-proxy g = ( act-cflow; resend; deact-cflow ) A-proxy f = ( ...; resend ) f g
    21. 21. Introduction // CaesarJ-like pseudo code class C { int x; void f() { ... } } class A { int C.y; void C.g() { ... } before(): execution(void C.f()) { ... } } ... deploy(new A()); ... actual-C f = ( ... ) C instance1-of-C actual-instance1-of-C x = 23 ... instance1-of-C.y ... instance2-of-C actual-instance2-of-C x = 42 A-int-proxy y = ( /* add y field to instance */; self y ) g = ( /* imp. of introduced method */ ) y A-int1-proxy y = 0
    22. 22. Agenda <ul><li>Context </li></ul><ul><ul><li>Modularization </li></ul></ul><ul><ul><li>Crosscutting Concerns </li></ul></ul><ul><li>A Dedicated Machine Model </li></ul><ul><ul><li>Object-based + Delegation </li></ul></ul><ul><ul><li>Support for Modularization Mechanisms </li></ul></ul><ul><li>Language Mappings </li></ul><ul><ul><li>j : Object-Oriented Programming </li></ul></ul><ul><ul><li>ij : Inter-Type Declarations </li></ul></ul><ul><ul><li>aj : Pointcut-and-Advice AOP </li></ul></ul><ul><ul><li>cj : Context-Oriented Programming </li></ul></ul><ul><li>Future Work </li></ul>
    23. 23. j – Object-Oriented Programming [Skipper04] class Subject ext Object { Integer attr Observer obs void doSomething(Object x) { this.attr := 25 } void changed(Object x) { this.obs.update(this) } void setObserver(Observer x) { this.obs := x } } class Observer ext Object { void update(Subject x) { out.println(x.attr) } } class Main ext Object { Subject s Observer o void main(Main x) { x.s := new Subject; x.o := new Observer; x.s.setObserver(x.o); x.s.doSomething(null); x.s.changed(null) } }
    24. 24. j Prepared Heap Subject_prototype attr obs Subject_proxy Subject doSomething = (...) changed = (...) setObserver = (...) Main_prototype s o Main_proxy Main main = (...) Observer_prototype Observer_proxy Observer update = (...) Object proxy Object
    25. 25. j Class Instantiation doSomething Subject_prototype attr obs Subject_proxy Subject doSomething = (...) changed = (...) setObserver = (...) Main_prototype s o Main_proxy Main main = (...) Observer_prototype Observer_proxy Observer update = (...) Object proxy Object subject_inst attr obs subj_inst_proxy
    26. 26. ij – Inter-Type Declarations [Skipper04] class Observer ext Object { void update(Subject x) { out.println(x.attr) } Subject <-- Observer obs Subject <-- void changed(Object x) { this.obs.update(this) } Subject <-- void setObserver(Observer x) { this.obs := x } } class Subject ext Object { Integer attr void doSomething(Object x) { this.attr := 25 } } class Main ext Object { Subject s Observer o void main(Main x) { x.s := new Subject; x.o := new Observer; x.s.setObserver(x.o); x.s.doSomething(null); x.s.changed(null) } }
    27. 27. ij Prepared Heap Subject_proto attr Subject_proxy Subject doSomething = (...) Main_proto s o Main_proxy Main main = (...) Observer_proto Observer_proxy Observer update = (...) Object proxy Object intr_proxy 1 changed = (...) setObserver = (...) obs=(... self obs)
    28. 28. ij Class Instantiation obs Subject_proto attr Subject_proxy Subject doSomething = (...) Main_proto s o Main_proxy Main main = (...) Observer_proto Observer_proxy Observer update = (...) Object proxy Object intr_proxy 1 changed = (...) setObserver = (...) obs=(... self obs) subject_inst attr subj_inst_proxy intr_proxy2 obs
    29. 29. aj – Pointcut and Advice AOP [Skipper04] class Subject ext Object { Integer attr void changed(Object x) { out.println(this.attr) } } aspect Observer { bool changed before set (Integer Subject.attr) { this.changed := v.neq(r.attr) } after set (Integer Subject.attr) { if (this.changed){ r.changed(null) } else { null } } } class Main ext Object { Subject s void main(Main x) { x.s := new Subject; x.s.attr := 25; } }
    30. 30. aj Prepared Heap setAttr attr Subject_proto attr Subject_proxy Subject setAttr = (... self attr ...) changed = (...) Main_proto s Main_proxy Main main = (...) Observer_Asp changed Object Object_proxy obs_proxy_1 setAttr = (... resend) obs_proxy_2 setAttr = (resend; ...) subject_inst attr obs subj_inst_proxy
    31. 31. cj – Context-Oriented Programming class Subject ext Object { Integer attr void Subject.setAttr(Integer x){ this.attr := x } void Subject.changed(Object x){ out.println(this.attr)} } layer Observer { bool changed void Subject.setAttr(Integer x) { thislayer.changed := x.neq(this.attr); proceed(x); if(thislayer.changed) { this.changed(null) } else { null }} } class Main ext Object { Subject s void main(Main x) { x.s := new Subject; x.s.setAttr(12); withlayer(Observer) { x.s.setAttr(25) } } }
    32. 32. cj Prepared Heap attr setAttr Subject_proto attr Subject_proxy Subject setAttr = (... self attr ...) changed = (...) Main_proto s Main_proxy Main main = (...) Observer_Lyr changed Object Object_proxy subject_inst attr obs subj_inst_proxy obs_proxy_1 setAttr = (... resend; ...)
    33. 33. Prototypical Implementation <ul><li>COLA Framework [Piumarta et al. ] </li></ul>
    34. 34. Experimental Implementation <ul><li>Implementation Substrate: VM Instructions </li></ul><ul><ul><li>(define-class ...) </li></ul></ul><ul><ul><li>(create-instance ...) </li></ul></ul><ul><ul><li>(create-proxy ...) </li></ul></ul><ul><ul><li>(insert-proxy ...) </li></ul></ul><ul><ul><li>(define-method ...) </li></ul></ul><ul><ul><li>(send ...) </li></ul></ul><ul><ul><li>(resend ...) </li></ul></ul><ul><li>Compiler for *j languages towards this substrate </li></ul><ul><ul><li>Transform PEG AST </li></ul></ul><ul><ul><li>Languages executable on top of the substrate </li></ul></ul>
    35. 35. Onward! (Listen up, OOPSLA!) <ul><li>Additional Join Points (Pointcuts) </li></ul><ul><ul><li>history-based </li></ul></ul><ul><ul><li>logic-based </li></ul></ul><ul><ul><li>call (?) </li></ul></ul><ul><li>Different Kinds of Advice </li></ul><ul><ul><li>asynchronous </li></ul></ul><ul><li>Formally Prove Language Mappings Correctness </li></ul><ul><ul><li>actor systems; “formal VM” </li></ul></ul><ul><li>Production Quality VM </li></ul><ul><ul><li>caching </li></ul></ul><ul><ul><li>garbage collection </li></ul></ul><ul><ul><li>maxine </li></ul></ul><ul><li>Dynamic Composition </li></ul>
    36. 36. Summary <ul><li>Dedicated Machine Model </li></ul><ul><ul><li>Object-based + Delegation </li></ul></ul><ul><ul><li>Support for Modularization Mechanisms </li></ul></ul><ul><li>Unifying Delegation-based Semantics </li></ul><ul><ul><li>j : Object-Oriented Programming </li></ul></ul><ul><ul><li>ij : Inter-Type Declarations </li></ul></ul><ul><ul><li>aj : Pointcut-and-Advice AOP </li></ul></ul><ul><ul><li>cj : Context-Oriented Programming </li></ul></ul><ul><li>Prototypical Implementation </li></ul>Thank You - Questions?

    ×