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. 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. 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. 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. 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. In the spirit of Smalltalk
Dynamic
Simple Powerful
Johan Fabry 3
9. In the spirit of Smalltalk
Dynamic
Dynamic AOP
Simple Powerful
Johan Fabry 3
10. In the spirit of Smalltalk
Dynamic
Dynamic AOP Develop normally
Simple Powerful
Johan Fabry 3
11. In the spirit of Smalltalk
Dynamic
Dynamic AOP Develop normally
Simple Powerful
Minimal set of Constructs
Johan Fabry 3
12. In the spirit of Smalltalk
Dynamic
Dynamic AOP Develop normally
Simple Powerful
Minimal set of Constructs
Uniform / no restrictions
Johan Fabry 3
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. 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
24. Inter-Type Declaration
PhClassModifier on: ACTestCase
addIV: 'phacount'
Dyn
Sim Pow
Johan Fabry 6
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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. Not in the paper ...
TDD
‣ 155 tests
‣ 90+% coverage
Johan Fabry 11
38. Not in the paper ...
TDD
‣ 155 tests
‣ 90+% coverage
Johan Fabry 11
39. Future work
Optimize the implementation
Compile PHANtom code
Infrastructure for Domain-Specific Aspect Languages
Johan Fabry 12