0
PHANtom:A Modern Aspect Language for PharoJohan Fabry, Daniel Galdames. PLEIAD Lab, DCC - Universidad de Chile
AOP ??  Johan Fabry   2
AOP ?? Cross-cutting concerns Aspect = module  ‣ Behavior = WHAT = advice  ‣ Quantification = WHEN = pointcuts Running appl...
AOP ?? Cross-cutting concerns Aspect = module  ‣ Behavior = WHAT = advice  ‣ Quantification = WHEN = pointcuts Running appl...
AOP ?? Cross-cutting concerns Aspect = module  ‣ Behavior = WHAT = advice  ‣ Quantification = WHEN = pointcuts Running appl...
AOP ?? Cross-cutting concerns Aspect = module  ‣ Behavior = WHAT = advice  ‣ Quantification = WHEN = pointcuts Running appl...
AOP ?? Cross-cutting concerns Aspect = module  ‣ Behavior = WHAT = advice  ‣ Quantification = WHEN = pointcuts Running appl...
In the spirit of Smalltalk                 Dynamic       Simple              Powerful   Johan Fabry                        3
In the spirit of Smalltalk                        Dynamic                 Dynamic AOP       Simple                     Pow...
In the spirit of Smalltalk                        Dynamic                 Dynamic AOP   Develop normally       Simple     ...
In the spirit of Smalltalk                        Dynamic                 Dynamic AOP   Develop normally       Simple     ...
In the spirit of Smalltalk                        Dynamic                 Dynamic AOP   Develop normally       Simple     ...
In the spirit of Smalltalk                        Dynamic                 Dynamic AOP   Develop normally       Simple     ...
In the spirit of Smalltalk                        Dynamic                 Dynamic AOP   Develop normally       Simple     ...
Pointcuts                       Dyn                 Sim         Pow   Johan Fabry                4
Pointcuts  PhPointcut receivers: TestCase      selectors: assert:                                           Dyn           ...
Pointcuts  PhPointcut receivers: TestCase      selectors: assert:  PhPointcut receivers: TestCase+      selectors: #(asser...
Pointcuts  PhPointcut receivers: TestCase      selectors: assert:  PhPointcut receivers: TestCase+      selectors: #(asser...
Pointcuts  PhPointcut receivers: TestCase      selectors: assert:  PhPointcut receivers: TestCase+      selectors: #(asser...
Advice                      Dyn                Sim         Pow  Johan Fabry                5
Advice PhAdvice pointcut: pc     send: #incCount: to: self     type: #after                                       Dyn     ...
Advice PhAdvice pointcut: pc     send: #incCount: to: self     type: #after PhAdvice pointcut: pc     advice: [:ctx |     ...
Inter-Type Declaration                               Dyn                         Sim         Pow   Johan Fabry            ...
Inter-Type Declaration  PhClassModifier on: ACTestCase      addIV: phacount                                         Dyn   ...
Inter-Type Declaration  PhClassModifier on: ACTestCase      addIV: phacount  PhClassModifier on: ACTestCase      addIM: ph...
Aspect PHAspect subclass: MyAspect ... (Object subclass: #PhAspect ...) Add PHAdvice and PHClassModifier instances Send in...
What happens here? |asp| asp := PhAspect new add:  (PhAdvice     pointcut: (PhPointcut         receivers: Transcript class...
What happens here? |asp| asp := PhAspect new add:  (PhAdvice     pointcut: (PhPointcut         receivers: Transcript class...
What happens here? |asp| asp := PhAspect new add:  (PhAdvice     pointcut: (PhPointcut         receivers: Transcript class...
What happens here? |asp| asp := PhAspect new add:  (PhAdvice     pointcut: (PhPointcut         receivers: Transcript class...
What happens here? |asp| asp := PhAspect new add:  (PhAdvice     pointcut: (PhPointcut         receivers: Transcript class...
What happens here? |asp| asp := PhAspect new add:  (PhAdvice     pointcut: (PhPointcut         receivers: Transcript class...
What happens here? |asp| asp := PhAspect new add:  (PhAdvice     pointcut: (PhPointcut         receivers: Transcript class...
What happens here? |asp|                 OM asp := PhAspect new add:  (PhAdvice     pointcut: (PhPointcut         receiver...
Reentrancy control PHANtom: no problem!  ‣ Aspect execution by default NOT MATCHED More power if you want it: Membranes [T...
Advice ordering Multiple advice 1 join point “Classic”: advice precedence  ‣ Global and static PHANtom deployment preceden...
Not in the paper ... TDD  ‣ 155 tests  ‣ 90+% coverage   Johan Fabry         11
Not in the paper ... TDD  ‣ 155 tests  ‣ 90+% coverage   Johan Fabry         11
Future work Optimize the implementation Compile PHANtom code Infrastructure for Domain-Specific Aspect Languages   Johan Fa...
http://pleiad.cl/PHANtomJohan Fabry                    13
Upcoming SlideShare
Loading in...5
×

PHANtom: A Modern Aspect Language for Pharo

653

Published on

ESUG 2011, Edinburgh

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

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

No notes for slide

Transcript of "PHANtom: A Modern Aspect Language for Pharo"

  1. 1. PHANtom:A Modern Aspect Language for PharoJohan Fabry, Daniel Galdames. PLEIAD Lab, DCC - Universidad de Chile
  2. 2. AOP ?? Johan Fabry 2
  3. 3. AOP ?? Cross-cutting concerns Aspect = module ‣ Behavior = WHAT = advice ‣ Quantification = WHEN = pointcuts Running application = stream of join points ‣ ST computation = messages ‣ In PHANtom: method exec Johan Fabry 2
  4. 4. AOP ?? Cross-cutting concerns Aspect = module ‣ Behavior = WHAT = advice ‣ Quantification = WHEN = pointcuts Running application = stream of join points ‣ ST computation = messages ‣ In PHANtom: method exec Johan Fabry 2
  5. 5. AOP ?? Cross-cutting concerns Aspect = module ‣ Behavior = WHAT = advice ‣ Quantification = WHEN = pointcuts Running application = stream of join points ‣ ST computation = messages ‣ In PHANtom: method exec Johan Fabry 2
  6. 6. AOP ?? Cross-cutting concerns Aspect = module ‣ Behavior = WHAT = advice ‣ Quantification = WHEN = pointcuts Running application = stream of join points ‣ ST computation = messages ‣ In PHANtom: method exec Johan Fabry 2
  7. 7. AOP ?? Cross-cutting concerns Aspect = module ‣ Behavior = WHAT = advice ‣ Quantification = WHEN = pointcuts Running application = stream of join points ‣ ST computation = messages ‣ In PHANtom: method exec Johan Fabry 2
  8. 8. In the spirit of Smalltalk Dynamic Simple Powerful Johan Fabry 3
  9. 9. In the spirit of Smalltalk Dynamic Dynamic AOP Simple Powerful Johan Fabry 3
  10. 10. In the spirit of Smalltalk Dynamic Dynamic AOP Develop normally Simple Powerful Johan Fabry 3
  11. 11. In the spirit of Smalltalk Dynamic Dynamic AOP Develop normally Simple Powerful Minimal set of Constructs Johan Fabry 3
  12. 12. In the spirit of Smalltalk Dynamic Dynamic AOP Develop normally Simple Powerful Minimal set of Constructs Uniform / no restrictions Johan Fabry 3
  13. 13. In the spirit of Smalltalk Dynamic Dynamic AOP Develop normally Simple Powerful Minimal set of Constructs First-class everything Uniform / no restrictions Johan Fabry 3
  14. 14. In the spirit of Smalltalk Dynamic Dynamic AOP Develop normally Simple Powerful Minimal set of Constructs First-class everything Uniform / no restrictions New language features Johan Fabry 3
  15. 15. Pointcuts Dyn Sim Pow Johan Fabry 4
  16. 16. Pointcuts PhPointcut receivers: TestCase selectors: assert: Dyn Sim Pow Johan Fabry 4
  17. 17. Pointcuts PhPointcut receivers: TestCase selectors: assert: PhPointcut receivers: TestCase+ selectors: #(assert: assert:equals:) Dyn Sim Pow Johan Fabry 4
  18. 18. Pointcuts PhPointcut receivers: TestCase selectors: assert: PhPointcut receivers: TestCase+ selectors: #(assert: assert:equals:) context: #(receiver sender arguments) Dyn Sim Pow Johan Fabry 4
  19. 19. Pointcuts PhPointcut receivers: TestCase selectors: assert: PhPointcut receivers: TestCase+ selectors: #(assert: assert:equals:) context: #(receiver sender arguments) PhPointcut receivers: Test* selectors: #(assert: assert:_: assert:_:_:) Dyn context: #(receiver) restrict: #(Tests_Mine) Sim Pow Johan Fabry 4
  20. 20. Advice Dyn Sim Pow Johan Fabry 5
  21. 21. Advice PhAdvice pointcut: pc send: #incCount: to: self type: #after Dyn Sim Pow Johan Fabry 5
  22. 22. Advice PhAdvice pointcut: pc send: #incCount: to: self type: #after PhAdvice pointcut: pc advice: [:ctx | Transcript show: (ctx receiver asString);cr. ctx proceed.]] Dyn type: #around. Sim Pow Johan Fabry 5
  23. 23. Inter-Type Declaration Dyn Sim Pow Johan Fabry 6
  24. 24. Inter-Type Declaration PhClassModifier on: ACTestCase addIV: phacount Dyn Sim Pow Johan Fabry 6
  25. 25. Inter-Type Declaration PhClassModifier on: ACTestCase addIV: phacount PhClassModifier on: ACTestCase addIM: phacount ↑phacount ifNil: [phacount := 0] Dyn Sim Pow Johan Fabry 6
  26. 26. Aspect PHAspect subclass: MyAspect ... (Object subclass: #PhAspect ...) Add PHAdvice and PHClassModifier instances Send install to activate Send uninstall to deactivate Dyn Sim Pow Johan Fabry 7
  27. 27. What happens here? |asp| asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: Transcript class selectors: show:) advice: [ Transcript show: Have ] type: #before). asp install. Transcript show: reentrancy control; cr Johan Fabry 8
  28. 28. What happens here? |asp| asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: Transcript class selectors: show:) advice: [ Transcript show: Have ] type: #before). asp install. Transcript show: reentrancy control; cr Johan Fabry 8
  29. 29. What happens here? |asp| asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: Transcript class selectors: show:) advice: [ Transcript show: Have ] type: #before). asp install. Transcript show: reentrancy control; cr Johan Fabry 8
  30. 30. What happens here? |asp| asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: Transcript class selectors: show:) advice: [ Transcript show: Have ] type: #before). asp install. Transcript show: reentrancy control; cr Johan Fabry 8
  31. 31. What happens here? |asp| asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: Transcript class selectors: show:) advice: [ Transcript show: Have ] type: #before). asp install. Transcript show: reentrancy control; cr Johan Fabry 8
  32. 32. What happens here? |asp| asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: Transcript class selectors: show:) advice: [ Transcript show: Have ] type: #before). asp install. Transcript show: reentrancy control; cr Johan Fabry 8
  33. 33. What happens here? |asp| asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: Transcript class selectors: show:) advice: [ Transcript show: Have ] type: #before). asp install. Transcript show: reentrancy control; cr Johan Fabry 8
  34. 34. What happens here? |asp| OM asp := PhAspect new add: (PhAdvice pointcut: (PhPointcut receivers: Transcript class selectors: show:) advice: [ Transcript show: Have ] type: #before).BO asp install. Transcript show: reentrancy control; cr Johan Fabry 8
  35. 35. Reentrancy control PHANtom: no problem! ‣ Aspect execution by default NOT MATCHED More power if you want it: Membranes [Tanter & Tabareau] Use membranes to control ‣ join point emission and capture scope ‣ aspect observing join points Dyn Sim Pow Johan Fabry 9
  36. 36. Advice ordering Multiple advice 1 join point “Classic”: advice precedence ‣ Global and static PHANtom deployment precedence ‣ Global and ‘static’ ‣ Complement or override on pointcut PHANtom dynamic precedence in the advice ‣ OrderedCollection of PHAdvice instances ‣ get from context Dyn ‣ set on context Sim Pow Johan Fabry 10
  37. 37. Not in the paper ... TDD ‣ 155 tests ‣ 90+% coverage Johan Fabry 11
  38. 38. Not in the paper ... TDD ‣ 155 tests ‣ 90+% coverage Johan Fabry 11
  39. 39. Future work Optimize the implementation Compile PHANtom code Infrastructure for Domain-Specific Aspect Languages Johan Fabry 12
  40. 40. http://pleiad.cl/PHANtomJohan Fabry 13
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×