Title: Un tour dhorizon des approches Modles Orients Aspects
1Un tour dhorizon des approches Modèles Orientés
Aspects
- Benoit Baudry
- INRIA Rennes Bretagne Atlantique
2AOSD
- Large and complex systems compose many different
concerns - This affects modularization
- Need to manage interactions between concerns
- Scattering
- One concern distributed all over the system, not
put in a well identified unit - Tangling
- One unit contains elements from different concerns
3Model Driven Engineering
Reliability
Security, survivability, robustness
Functionality
Safety
Fault tolerance
4Aspect Oriented Modelling
Code Model
5Aspect Oriented Modeling
- Separation of concerns in a model
- A concern is not necessarily cross-cutting
- Model composition
- Build a global view from a set of concern models
- AOM is a wide domain
- Captures a large variety of modeling practices
- A large number of composition approaches
- Still an emerging domain
6- Views on a model are concerns if they contain
elements that have the same interpretation
7Aspect Oriented Modeling
- Separate concerns at different levels of
abstraction - Requirements engineering identify features and
cross-cutting concerns from requirement documents - Awais Rashid, Joao Araujo, Ana Moreira, Elisa
Beniassad - Feature modeling AOM for product derivation
- Architecture
- Mehmet Aksit, Olivier Barais
- Design
- Robert France, Siobhan Clarke, Jacques Klein,
Jeff Gray, Jon Whittle
8Model Composition
- AspectJ like composition
- Transat
- Klein
- Motorola Weavr
- HyperJ like composition
- Theme/UML UML scenarios and class diagrams
- Kompose compose structural models
- Match Merge compose statechart models
- Others
- MATA
- SmartAdpaters
- EML
9- Existing model composition approaches
- Synthesis on AOM and model composition
- AOM and AOP
- AOM and MDE
10Existing approaches for AOM
- Rondo (DB Schema)
- Signature-based
- MATA
- TReMer
- Theme / UML
- UML2 Package Merge
- Prompt (Ontology)
- Match Merge
- Epsilon (EML)
- Moment
- Atlas Model Weaver
- Smartadapters
- RAM
- MOFLON / Fujaba
- Klein
- Weavr
?
?
?
?
?
11Smartadapters
- A generic framework for AOM
- Can be adapted to different modeling languages
- Intends to be as flexible as possible
- P. Lahire, B. Morin, G. Vanwormhoudt, A.
Gaignard, O. Barais, and J.-M. Jézéquel.
Introducing variability into aspect-oriented
modeling approaches . MoDELS07
12Smartadapters 3 elements for composition
B
B
ClassA
ClassB
ClassA
ClassB
A
Join points identification
ClassC
C
C
Advice
Add a root element
Add a final state
root
B
ClassA
ClassB
final
Composition
A
C
ClassC
13Smartadpaters a generic composition framework
Generic
1
Pattern matching engine
Adaptation metamodel weaver
Pointcut language
Domain-specific AOM framework
Domain
2
Domain-specific adaptations
uses
automatic generation
customization
14Generating the Pointcut Language
FSM
containingFSM 1..1
containingFSM 1..1
any
states 0..
transitions 0..
MM
State
Transition
a poincut
source 1..1
target 1..1
FSM
containingFSM 0..1
containingFSM 0..1
MM
states 0..
transitions 0..
State
Transition
source 0..1
target 0..1
15Generating the Pointcut Language
1
- MM' MM except
- No invariant or precondition in MM'
- All features are optional in MM' (lower bound0)
- No abstract element in MM'
FSM
containingFSM 0..1
containingFSM 0..1
MM
states 0..
transitions 0..
State
Transition
source 0..1
target 0..1
- Matching Model Snippets R.Ramos, O.Barais and
J.M. Jézéquel accepted at the MoDELS'07
conference, Sept. 30 to Oct. 5, Nashville, TN,
USA
16Generating Adaptations
FSM
FSM
containingFSM 1..1
containingFSM 1..1
states 0..
transitions 0..
MM
State
Transition
Transition
source 1..1
target 1..1
final
t
B
A
Composing this snippet means
- adding final and t in the base FSM
- setting the source of t
C
C
17Generating Adaptations
- For each metaclass MyMetaClass in MM
- setMyMetaClass
- unsetMyMetaClass
- createMyMetaClass
- cloneMyMetaClass
2
- setFSM unsetFSM createFSM cloneFSM -
setTransition unsetTransition createTransition
cloneTransition - setState unsetState createState
cloneState
18Smartadapters example
anyFSM
final
any
any
t
False positive
Structure
Template(pointcut)
SetFSM -aFSManyFSM -statesfinal
-transitionst setTransition
-aTransitiont -aSourceany
-aTargetfinal makeUnique -elementfinal
B
B
final
A
C
False
C
No aspect/base coupling protocol
f(template,structure)
19Weaving engine
- Load adapter base model
- Pattern matching bindings
- Binding Role (template elt) -gt base model
element - For each binding b selected by the user
- Apply the composition protocol
- Just call adapter.apply(b)(directly implemented
in the adaptation metamodel) - Save the result
20MATA (Jon Whittle et al.)
- Model composition using a transformation approach
- Motivation get the full power of transformation
languages for composition - Reuse critical pair analysis to identify
conflicts and dependencies between aspects - Adds a UML concrete syntax on top of graph
transformation rules - Can be adapted to different modeling languages
- UML class, state and sequence models
21Model Composition - MATA
Shopping Cart
Shipping
22Model Composition - MATA
Base Model
Aspect
23MATA composing statecharts
a) Notify call waiting
Waiting for hold prompt
OK / put on hold
Idle
incoming call / display call info
hang up
incoming call / display call info
On Call
disconnect
Waiting
pick up
24MATA interactions analysis
Waiting for hold prompt create
incoming call / display call info
OK / put on hold
On Call
Idle
hang up
incoming call / display call info
On Call
disconnect
a) Notify call waiting
Waiting
pick up
incoming call /
create timeout / fwd to voice mail
b) Take a message
25MATA interactions analysis
26MATA aspect interaction
- The order of composition has an impact on the
result - a) notify call waiting -gt b) take a message
- b) take a message -gt a) notify call waiting
- In the second case, calls that are received
during an existing call are not sent to voice mail
27Kleins approach
- Dedicated sequence diagrams
- Leverages the modeling language
- Loop unrolling
- AspectJ like
28ContextWeaving of Scenarios
A base scenario
A behavioural aspect
Aspect
Pointcut
customer
server
log in
customer
server
try again
new attempt
new attempt
try again
try again
new attempt
Advice
try again
new attempt
customer
server
new attempt
new attempt
new attempt
ok
save bad attempt
save bad attempt
save bad attempt
try again
try again
try again
29What do we propose? A semantic-based weaving
A base scenario
A behavioural aspect
HMSC H
bMSC Propose
Aspect
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
30Result
One time
customer
server
try again
new attempt
31Result
customer
server
try again
new attempt
32Result
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
33Result
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
34CSU AOM
- Y. R. Reddy, S. Ghosh, R. France, G. Straw, J.
Bieman, N. McEachen, E. Song, and G. Georg,
Directives for Composing Aspect-Oriented Design
Class Models , TAOSD - Aspect models are templates
- Capture an essential structure
- Reusable
- Composition for structural models
- Similiarities captured through signatures
- Possible alignment with pre / post directives
- Automatic merge
35AOM composition overview
instantiate
Values used in the bindings
Namespace
Model element names
Composition directives
Values used in the bindings
instantiate
compose
Composed class model
36Class diagram template example
Class template
Attribute template
Requestor
reqID
Multiplicity parameter
x.lower gt0 y.lower gt0
x
accesses
Association template
y
Constraints on values that can be substituted for
multiplicity parameters
Entity
operation 1.. (reqId, params)
Collection parameter
Operation template
Instantiation multiplicity
37An Instantiation of class diagram template
Requestor
Bindings specified as (Aspect model parameter,
application-specific element) pairs Requestor,
Customer reqID, CustId Entity, Bank operation,
Withdraw Operation, Deposit
reqID
x
accesses
y
Entity
operation 1.. (params)
38Signature-based composition
Model 1
Model 2
Customer
Customer
Account
name String address int
name String
updateAcct() String
updateAcct() int
39Kompose for model composition
Model A
Model B
- Signature-based approach algorithm
- Signatures defined for each modeling language
- Directives language
- Create objects
- Add objects
- Remove objects
- Modify objects
- Prototype in Kermeta
- Kompose
Kompose
Pre-Merge dir.
Pre-Merge dir.
Model A'
Model B'
Signature-based merge
Composed Model
Post-Merge dir.
Composed Model
40Directives example
Bank
lt Primary model
BLP
Aspect model gt
41Directives example
// Primary Model URI PM "Bank.ecore" // Aspect
Model URI AM "BLP.ecore" // Composed Model
URI CM "BankBLP.ecore" // predirectives for
primary model PMPre // predirectives for
aspect model AMPre // Rename package BLP to
Bank BLP.name "Bank" // postdirectives
Post BankController.eOperations -
BankControllertransfer BankController.eOpe
rations - BankControllerwithdraw
42Statecharts match and merge
- Starts from a need at ATT
- Many models for different variant specifications
- The cost of maintaining variant models is
proportional to the number of models - Need to compose the models to reduce the costs
- An algorithm for statechart composition
- Match operator identifies similarities between
states - Merge operator
- Nejati, S., M. Sabetzadeh, M. Chechik, S. M.
Easterbrook and P. Zave, "Matching and Merging of
Statecharts Specifications". ICSE'07
43Statecharts match and merge
- Match operator
- Static matching typographic and linguistic
similarities on names - Behavioural matching assigns similiraty values
to pairs of (state, transition). This is an
approximation of bisimilarity - Evaluation
- Precision rate of correct matches to the total
of matches - Recall rate of correct matches to the total of
correct matches - Combination of static and behavioural matching
- Medium precision and high recall
44Statecharts match and merge
- Merge operator
- Behaviour shared by M1 and M2 common behaviour
- Behaviour not shared by M1 and M2 variabilities
- Behaviour preserving
45Statecharts match and merge
46Statecharts match and merge
47Synthesis
- Smartadapters
- generic AOM
- MATA
- model transformation with concrete syntax
- Klein
- Sequence disgrams, semantic composition
- RBML and signature-based composition
- Class models, reusable aspect models
- Match and merge
- statecharts, semantic preserving
48- Existing model composition approaches
- Synthesis on AOM and model composition
- AOM and AOP
- AOM and MDE
49Synthesis on AOM
- Separation of concerns
- Composition
- A common process what where how
- Expressivity / adaptability
- Language
50Separation of concerns
- Intent of separation
- Product line modeling features and variation
points are modeled as separate concerns - Reusable aspect models build models that can be
reused in the design different systems - Analyzable concerns separate the
characteristics of a system in order to analyse
them separately before building a larger system
51Separation of concerns
- Separation at different levels of granularity
- Fine grained decomposition for finer grain /
model construction - Ex the transaction concern in RAM
- Coarse grained decomposition
- Analyse the concerns separately
- Ex security
52Composition
- Many different approaches for model composition
- Again, different purposes
- Collaborative development compose models that
have been developed in parallel - Compose different variants to limit the
maintainance cost - Analyze the result of composition
- Use the result of composition as a further step
in the design
53Composition
- Three questions have to be answered
- What?
- Where?
- How?
- All the approaches vary in the degree of
adaptability they let to answer these questions
54Composition what?
- Identify the similar elements in both models
- Elements are similar in two models if they have
the same meaning - Same interpretation as defined by Spanoudakis
M1 (models)
interpretation
interpretation
M0 (real world)
55Composition what?
- Difficult to establish the interpretation
relation for each element in the model - A little bit easier to compose elements from the
same metamodel - Only elements that have the same type can have
the same interpretation - When the models to compose have different
metamodels it is necessary to specify
interpretation at the meta level
56Composition where?
- Critical for behavioural models
- When composing scenario A after B does not mean
the same as B after A - The place where the elements should be composed
can be declared with a pattern language - Mata, Smartadapters, Klein
57Composition how?
- What process to perform on the model to integrate
new elements - Merge, insert, replace, etc.
- Default strategies in some composition algorithms
- Match and merge, signature-based
- Explicit in Smartadapters
58Expressiveness / adaptability
- Trade-off on the limitation of expressiveness
- Match and merge
- Fully automatic
- Garantees some properties preservation
- Very constrained
- Everything is wired in the algorithm
- MATA
- Full power of graph transformation
- Easily applied on numerous modeling languages
- Requires a lot of additional input
- All properties have to be checked after
composition
59Model Composition - Scheme
- C. Jeanneret An analysis of model composition
approaches . Masters thesis.
60Model Composition - Scheme
61Model Composition - Scheme
62Model Composition - Scheme
63Model Composition - Signatures
64Model Composition - MATA
65- Existing model composition approaches
- Synthesis on AOM and model composition
- AOM and AOP
- AOM and MDE
- AOM and development cycle
66Aspect-oriented programming
- Joinpoint
- Element in the base prog.
- class, method, ...
- Pointcut
- Set of joinpoints
- Advice
- Additional concern
- Aspect
- Pointcut descriptor advice
67AspectJ
- AspectJ (www.aspectj.org)
- Le langage de référence de l'AOP
- aspect Log
- pointcut traceMethode()
- call( void Figure.set(int) )
- execution( ! public static com.xerox..
(..) ) - before() traceMethode()
- System.out.println("..")
Pointcut descriptor (PCD) set of joinpoints
Advice associated to the PCD
68AOM and AOP
- Cross-cutting concerns
- Always in AOP
- Not necessary in AOM
- Scale
- Fine grained concerns in AOP
- Granularity can vary in AOM
- Development cycle
- Low level concerns in AOP
- AOM can capture high-level concerns
- Language
- AOP lanaguages are specific to one programming
language - In AOM it might be necessary to compose aspects
in different languages - Aspect interactions and evolution
- Challenge for both AOM and AOP
69- Existing model composition approaches
- Synthesis on AOM and model composition
- AOM and AOP
- AOM and MDE
70MDE and AOM
- Transformation vs. composition
71MDE and AOM
72Model composition and transformation
- MATA
- Dimitrios S. Kolovos, Richard F. Paige and Fiona
A.C. Polack, "Merging Models with the Epsilon
Merging Language" - Baudry, B., F. Fleurey, R. France and R. Reddy,
"Exploring the Relationship between Model
Composition and Model Transformation"
73Challenges
- Composing heterogeneous models or multi-view
models - Ex (CD, SD) (CD, SD)
- Initial proposal in RAM
- Conflicts / interactions between aspects
- Initial proposal in MATA with critical-pair
analysis to detect dependencies and conflicts - Safety
- When is the result of composition correct?
- Dealing with different levels of abstraction
- Is an aspect at design level an aspect at the
code level? - Evolution
- When the bas model evolves do you need to re-run
the composition?
74References
- Acknowledgements Cédric Jeanneret (Zurich Uni.)
and Robert France (CSU) - Master thesis Cédric Jeanneret
- Google tech talk, Jon Whittle (available on
youtube) - AOM workshop series