Title: Behavioural Aspects and Weaving
1Behavioural Aspects and Weaving
PhD Thesis work
- Jacques Klein
- IRISA / INRIA University of Rennes 1 Triskell
Supervisor Jean-Marc Jézéquel Assistant
supervisor Loïc Hélouët
Luxembourg, 21/02/2007
2Building Large Software Systems
- Importance of non-functional properties
- distributed reactive systems, persistence,
monitoring, - quality of service reliability, latency,
performance... - Variations in functional aspects
- notion of product lines (space, time)
How modularize each concern to manage changes?
1.0
3Modeling Weaving
- Challenges
- Automatic Weaving
4Aspect-Oriented Software Development (AOSD)
- Avoid the "tyranny of the dominant
decomposition"Tar99 - which prevents from modularize some concerns
- AOSD Concepts
- these concerns are encapsulated in aspects
- a aspect defines un set of join points specified
by a pointcut - the composition of the aspects is called weaving
- AOSD emerged at the programming level (AOP) with
AspectJ - Kiczales et al., ECOOP 97
- gtgt identified by the MIT as one of the 10 key
technologies of the decade
expected benefits ? better modularisation,
maintainable upgradeable reusable
5Model Weaving
- Weaving of structural models relatively well
defined (France et al.) - Weaving of behavioural aspects only at the
runtime - pattern matching at the runtime (event AOP,
Douence et al) - mechanism of "cflow" proposed by AspectJ
- ? dynamic weaving problems of performance, of
validation and possible weavings - What is the (static) weaving of behavioural
aspects? - ? use scenarios (MSCs)
- formal basis, simplicity and power,
6Static Weaving of Behavioural Aspects
Behavioural Aspect
Base Scenario
Aspect
user
server
Pointcut
log in
try again
user
server
new attempt
new attempt
try again
try again
new attempt
Advice
try again
new attempt
user
server
new attempt
new attempt
new attempt
ok
save
save
save
try again
try again
try again
7Plan of the presentation
- Introduction of the language of scenarios used
- Several definitions of join points
- Detection in infinite scenarios
- Composition of scenarios
- Implementation
8Message Sequence Charts (MSCs) (or SD) low
level bMSC
bMSC M
A
B
C
m1
m2
a
m3
- bMSC defines a set of events and a partial
order on these events
9Message Sequence Charts high level HMSC
HMSC H
s0
bMSC log
user
server
log in
s1
bMSC Accept
bMSC newAttempt
user
server
user
server
try again
ok
new attempt
s2
10Plan of the presentation
- Introduction of the language of scenarios used
- Several definitions of join points
- Detection in infinite scenarios
- Composition of scenarios
- Implementation
11Join Point and language of pointcut
- combined with a pointcut language which allows
the specification of the areas where an aspect
has to be woven with the base model - A join point represents an area where an aspect
is interleaved with a other concern - The pointcut language is the mechanism which
allows the separation of a crosscut concern (an
aspect) from a base model.
12Join Point Definition
J
Pointcut
base
A
B
A
B
C
m1
m1
m2
m3
m3
- A part J of a base scenario is a join point
whether there exists an bMSC isomorphism from the
pointcut and J.
134 definitions of join points
- 2 main strategies of detection LMO06, TAOSD 07
- non-strict sequence of messages
- strict sequence of messages
facilitates the weaving of several aspects
- decidability for infinite scenarios
14A join point can be a sub-bMSC
M1
M2
C1
C2
C1
C2
m0
m0
Pointcut
m1
m1
m2
m2
C1
C2
m3
m1
m2
M4
M3
C1
C2
C1
C2
m1
m1
m4
m3
m2
m2
15A join point can be a closed part
M1
M2
C1
C2
C1
C2
m0
m0
Pointcut
m1
m1
m2
m2
C1
C2
m3
m1
m2
M4
M3
C1
C2
C1
C2
m1
m1
m4
m3
m2
m2
16Weaving of several aspects at the same join point
Aspect 2
Aspect 1
Pointcut
Pointcut
base
user
server
user
server
log in
log in
user
server
try again
try again
log in
save
try again
Advice
Advice
user
server
display
user
server
log in
log in
update
save
try again
try again
update
17A join point can be a safe pattern
M1
M2
C1
C2
C1
C2
m0
m0
Pointcut
m1
m1
m2
m2
C1
C2
m3
m1
m2
M4
M3
C1
C2
C1
C2
m1
m1
m4
m3
m2
m2
18A join point can be a general part
M1
M2
C1
C2
C1
C2
m0
m0
Pointcut
m1
m1
m2
m2
C1
C2
m3
m1
m2
M4
M3
C1
C2
C1
C2
m1
m1
m4
m3
m2
m2
19Successive join points
M
Pointcut
C1
C2
m1
C1
C2
m1
m1
m2
m2
m1
m2
- we define a (partial) order on the part
- we have shown that this order has an unique
minimum element J - we continue on M-?J
20Plan of the presentation
- Introduction of the language of scenarios used
- Several definitions of join points
- Detection in infinite scenarios
- Composition of scenarios
- Implementation
21What do we propose? Detection based on the
semantics of the language AOSD 2006
A base scenario
A behavioural Aspect
HMSC H
Aspect
bMSC Propose
Pointcut
customer
server
customer
server
log in
new attempt
try again
bMSC Accept
bMSC Retry
Advice
customer
server
customer
server
customer
server
new attempt
try again
ok
save bad attempt
new attempt
try again
22Result
unfold once
customer
server
try again
new attempt
23Result
customer
server
try again
new attempt
24Result
HMSC H'
customer
server
log in
customer
server
customer
server
try again
try again
new attempt
customer
server
try again
try again
new attempt
new attempt
new attempt
customer
server
ok
25Result
HMSC H'
L(H)L(H')
customer
server
log in
customer
server
customer
server
try again
try again
new attempt
customer
server
customer
server
new attempt
new attempt
save bad attempt
save bad attempt
try again
try again
new attempt
26HMSC Transformation
A base scenario
Pointcut
HMSC H
s0
customer
server
bMSC Propose
new attempt
try again
customer
server
log in
s1
bMSC Accept
bMSC Retry
customer
server
customer
server
try again
ok
new attempt
s2
27HMSC Transformation
- First step compute the potential matches
s0,Me
Propose
Retry
s1,Me
Retry
s1,Pm
Accept
Pointcut
Accept
customer
server
s2,Me
new attempt
try again
28HMSC Transformation
- Second step compute the future matches
Propose
Retry
Retry
s1,Pm,Pm
Retry
Accept
Pointcut
Retry
customer
server
new attempt
Accept
try again
29Transformation de HMSC
- Third step use regular expression, split bMSCs
into atoms and permute these atoms
Retry (Retry) Retry
R1R2 (R1R2) R1R2
R1(R2 R1) R2R1R2
bMSC Retry
customer
server
try again
new attempt
30HMSC Transformation
Result
Propose
Retry
Accept
Accept
31Result
HMSC H
customer
server
log in
customer
server
customer
server
try again
try again
new attempt
customer
server
customer
server
new attempt
new attempt
save bad attempt
save bad attempt
try again
try again
new attempt
32Plan of the presentation
- Introduction of the language of scenarios used
- Several definitions of join points
- Detection in infinite scenarios
- Composition of scenarios
- Implementation
33Composition FMICS 04, LMO 06, TAOSD 07(it
depends on the join point definition)
sequential composition
base scenario
result
A
A
Advice
JP
Advice
B
B
A JP B
A Advice B
34AmalgamatedSum
advice
I1
I2
m1
a
m3
35AmalgamatedSum
result
advice
I1
I2
m1
a
m3
g
f
36AmalgamatedSum
result
m2
a
advice
I1
I2
m1
a
m3
g
f
37Plan of the presentation
- Introduction of the language of scenarios used
- Several definitions of join points
- Detection in infinite scenarios
- Composition of scenarios
- Implementation
38Kermeta
- language dedicated to the handling of models
- allows the use of existing modelling tools as
EMF, Topcased, Omondo, etc
39Implementation
Morphismes PC/Base
MMSC
MMM
Morphismes PC/Base
Pointcut
Morphisms PC/Base
(1) detection
MMSC
Base
(2) Composition
Advice
MMSC
MMSC
MMM
MSC Result
Morphism PC/AD
40Weaving of an aspect (P,Ad)
If P is connected, the detection problem is
decidable
Set of HMSCs
specific classes of HMSCs
weaving of (P,Ad)
weaving of (P,Ad)
commutation which leads to a solution
41Result / ConclusionStatic weaving of behavioural
aspects
- Difficulty for the detection of successive join
points - Difficulty for the weaving of several aspects
- Necessity to use advanced composition operators
- Several specific notions of join points
- Necessity to take the semantics of the model used
into account
42Result / ConclusionStatic weaving of behavioural
aspects
- The result of the weaving can be validated before
the implementation (productivity gain and time
gain) - Can target non-aspect-oriented platform (when the
weaving is impossible at the programming level) - Specification of pointcuts improved
- When the aspects have been woven, its difficult
to identify them traceability problem
43Perspectives (short term)
- Conditions which allow the identification of
classes for the detection problem (in infinite
scenarios) for which the problem is decidable - Identification of conflicts between aspects
44Widest Perspectives
- Propose weavers for other types of models (state
charts, etc) - Automatic update of various models
- Test and development with aspects
- Methodology for development with aspects
45Dissemination
- Several definitions of join points LMO 2006 and
TAOSD - Detection in infinite scenarios AOSD 2006
- Composition of scenarios FMICS 2004, LMO 2006,
TAOSD - European Network of Excellence AOSD-Europe
- Collaboration with the team DSG of the Trinity
College of Dublin
46 47Un scenario de base
Un aspect
Comportement Attendu
customer
server
4
1
3
3
3
3
2
48Limites
Tissage impossible
scénario de base
Aspect
customer
server
Exp. de coupe
a
b
HMSC H
a
customer
server
bMSC M
a
b
a
b
customer
server
a
a
b
b
a
a
Advice
a
customer
server
a
b
m
a
b
a
49Limites
Tissage impossible
customer
server
Aspect
a
customer
server
b
m
Exp. de coupe
a
b
m
n fois
a
customer
server
m
a
b
a
b
a
m
b
a
Advice
a
customer
server
a
n fois
customer
server
a
b
m
m
a
b
Comportement attendu
a
Comportement attendu
50Conditions suffisantes
bMSCs non-connexes
bMSCs connexes les algorithmes se terminent
bMSC M
bMSC M
customer
server
customer
server
a
b
a
b
m
bMSC M
bMSC M
server2
server3
customer
server1
server3
customer
server1
server2
m1
m1
b
b
m3
m2
m2
m2
m2
M? M1 M2
M M1 M2