Title: Model Evolution with Aspectoriented Mechanisms
1Model Evolution with Aspect-oriented Mechanisms
IWPSE 2005International Workshop on Principles
of Software Evolution
- Naoyasu Ubayashi (Kyushu Institute of
Technology) - Tetsuo Tamai (University of Tokyo)
- Shinji Sano, Yusaku Maeno, Satoshi Murakami
(Kyushu Institute of Technology) - 6 September 2005
2Overview
- Motivation
- An extensible model compiler based on AO
- Evolution based on extensible model compiler
- Related work
- Conclusion
31. Motivation
4Issues to be tackled
- Model-based development is a software development
method in which models are created before source
code is written. - Although the method is effective, we have to
modify models when we face evolution such as
change of platforms. - These modifications crosscut over many places in
the models, and tend to cause unexpected errors.
New platforms
New requirements
Optimization
Evolution!
5How does MDA deal with this problem ?
OOSD
MDA
CIM
Analysis
PIM
Design
model compiler
PSM
We can regard PIMs as new kinds of reusable
software components because they can be reused
even if a platform is changed.
Coding
Source code
MDA Model-Driven Architecture PIM Platform
Independent Model CIM Computation Independent
Model PSM Platform Specific Model
6But,
Multiple concerns
- Although MDA is effective for software
development, it mainly focuses on
platform-specific concerns. - We have to modify models when we face evolution
related to other kinds of concerns including
application-specific optimization, security
policies, and deployment. - It is necessary to allow a modeler to customize
transformation rules because model modifications
for dealing with these concerns may be specific
to an application.
Extensibility
7Motivating example -- A simple bulletin board
system
8Example of model evolution
Variation of Second Version
Original
First Version
Second Version
Platform concern
Optimization concern
Logging concern
logging
modifications crosscut over many places
logging
make a product that is executable on the Struts
platform
optimize memory usage
add a logging function for debugging
9Our approach
- We propose a method for model evolution using an
extensible model compiler based on aspect
orientation, a mechanism that modularizes
crosscutting concerns. - Previously we proposed an AO modeling language
called AspectM that supports modeling-level
aspects. - We demonstrate the effectiveness of AspectM in
terms of model evolution.
N.Ubayashi, T.Tamai Concern Management for
Constructing Model Compilers, MACS 2005
(Workshop at ICSE 2005) N.Ubayashi, T.Tamai, et
al. Model Compiler Construction Based on
Aspect-oriented Mechanisms, GPCE 2005 (to appear)
10Extensible model compiler
Modeling
Aspect
AspectM
Aspect
UML model
UML model
weave
UML model
UML model
(ex. PIM)
(ex. PSM)
Extensible model compiler
Using AspectM, a modeler can extend model
transformation rules by defining new aspects in
the process of modeling.
11Evolution at the modeling level
model compilation using aspects
Base Model
Variation
Ver.1
Model for Product n
Model for Product 1
Model for Product 2
model compilation using aspects
Version
Ver.2
Model for Product 1
Model for Product 2
Model for Product n
12Advantage of our approach
- Using our extensible model compiler, a series of
models can be generated from a single abstract
model that embodies only core concerns such as
business logics. - The model does not include such concerns as
platforms and application-specific optimizations.
These concerns vary according to product
specifications. - Model transformations enable us to shift from
code-centric product-line engineering (PLE) to
model-centric PLE.
132. An extensible model compiler based on AO
- -- from our previous work
14Aspect orientation
AOP is based on the JPM (Join Point Model).
Join point
program execution points including method
invocations and field access points
Pointcut
a means of extracting a set of join points
related to a specific crosscutting concern from
all join points
Advice
a means of raising effects at the join points
15Aspect orientationat the modeling-level (example)
Extension of JPMs (Join Point Models) in AOP
16JPMs for model transformations
PA(pointcut advice),CM(composition),NE(new
element),OC(open class),RN(rename),RL(relation)
17AspectM
- AspectM is an aspect-oriented modeling language
that supports six kinds of JPMs. - In AspectM, an aspect can be described in either
a diagram or an XML format. - AspectM provides the two kinds of aspects
ordinary aspect and component aspect. A component
aspect is a special aspect for composing aspects. - An aspect can have parameters for supporting
generic facilities. By filling parameters, an
aspect for a specific purpose is generated.
18Example of AspectM descriptions
pointcut classA classB
aspect
advice
ltlt OC gtgt addAttributeX
classA
classA
add new attributes
new attributes
classB
classeAandB class pointcut-bodycname(cla
ssA) cname(classB)
classC
classB
new attributes
merge classAandB add-attribute
advice-bodyattributeX
ltaspect nameaddAttributeX typeordinary
jpmOC" gt ltpointcut nameclasseAandB
typeclassgt ltpointcut-bodygt cname(classA)
cname(classB) lt/pointcut-bodygt lt/pointcutgt
ltadvice nameadd-attributeX typeadd-attribute
ref-pointcutclassAandBgt ltadvice-bodygt
attributeX lt/advice-bodygt lt/advicegt lt/aspectgt
19Implementation of model compiler
Aspect diagram (XML)
Model Compiler
XSLT style sheet for converting aspect (XML) to
XSLT style sheet
XSLT processor
The first transformation phase
XSLT style sheet for converting UML (XML)
to UML (XML)
The second transformation phase
XSLT processor
UML diagram (XML)
UML diagram (XML)
203. Evolution using extensible model compiler
21Example of model evolution
Variation of Second Version
Original
First Version
Second Version
Platform concern
Optimization concern
Logging concern
logging
modifications crosscut over many places
logging
make a product that is executable on the Struts
platform
optimize memory usage
add a logging function for debugging
22Model transformation for first version
Platform Struts
Step1 merge PIMs
1) merge PIM classes
Step 2 transform the merged class to an action
form bean class
platform concerns crosscut over model elements
2) change the name of merged class 3)
inherit ActionForm 4) add setter/getter
PSM
PIM
Step 3 create an action class
5) create an action class 6) inherit Action 7)
add execute method 8) add a method body
23Aspect for the first version
Platform Struts
aspect
Step1 merge PIMs
ltlt CM gtgt MergeClasses
1) merge PIM classes
inputClasses class pointcut-bodycname(Me
ssage) cname(MessageProfile)
Step 2 transform the merged class to an action
form bean class
2) change the name of merged class 3)
inherit ActionForm 4) add setter/getter
merge inputClasses merge-by-name
advice-bodyPostMessage
Step 3 create an action class
5) create an action class 6) inherit Action 7)
add execute method 8) add a method body
24Component, Generics
component
ltaspect name"Generic-Classes2ActionFormBean"
type"component"gt ltparamsgt ltparamgt
_at_input-classes_at_ lt/paramgt ltparamgt
_at_merged-class_at_ lt/paramgt lt/paramsgt ltaspect
name"MergeClasses" template"Generic-MergeClasses
"gt ltset-param name"_at_input-classes_at_"gt
_at_input-classes_at_ lt/set-paramgt ltset-param
name"_at_merged-class_at_"gt _at_merged-class_at_
lt/set-paramgt lt/aspectgt ltaspect
name"SetActionFormBeanName" template"Generic-Set
ActionFormBeanName"gt ltset-param
name"_at_class_at_"gt _at_merged-class_at_ lt/set-paramgt
lt/aspectgt ltaspect name"InheritActionForm"
template"Generic-InheritActionForm"gt
ltset-param name"_at_sub-class_at_"gtconcat(
_at_merged-class_at_ ,"Form")lt/set-paramgt lt/aspectgt
ltaspect name"AddAccessors" template"Generic-Add
Accessors"gt ltset-param name"_at_class_at_"gtconcat(
_at_merged-class_at_ ,"Form")lt/set-paramgt
lt/aspectgt lt/aspectgt
generics
Step1
Step2
25Aspect for the second version
aspect
ltaspect name"DeleteAttribute"
type"ordinary" jpm"OC"gt ltpointcut
name"postMessageClass"
type"class"gt ltpointcut-bodygt
cname(PostMessage) lt/pointcut-bodygt
lt/pointcutgt ltadvice name"deleteDate"
adviceType"delete-attribute"
ref-pointcut"postMessageClass"gt
ltadvice-bodygt date lt/advice-bodygt
lt/advicegt lt/aspectgt
ltlt OC gtgt DeleteAttribute
postMessageClasse class
pointcut-bodycname(PostMessage)
merge postMessageClasse delete-attribute
advice-bodydate
26Aspect for a variation
ltaspect name"LoggingSetter"
type"ordinary" jpm"PA"gt ltpointcut
name"allSetter" type"method"gt
ltpointcut-bodygt oname(set)lt/pointcut-bodygt
lt/pointcutgt ltadvice name"logSetter"
adviceType"before"
ref-pointcut"allSetter"gt ltadvice-bodygt
Log.write() lt/advice-bodygt
lt/advicegt lt/aspectgt
aspect
ltlt PA gtgt LoggingSetter
allSetter method pointcut-bodyoname(set
)
merge allSetter before
advice-bodyLog.write()
27Model evolution (example)
Original Model
Aspect Generic-Classes2ActionFormBean
Version
Ver.1
Model for Struts Platform
Aspect DeleteAttribute
Aspect LoggingSetter
Version
Ver.2
Variation
Optimized Model for Struts Platform
Logging
28Towards product-line engineering
defined by modelers
Aspect library for other platforms
Product X
Application-specific aspects
Aspect library for .NET
weave
Aspect library for J2EE
UML diagrams
Aspect library for other product-lines
Product Y
Application-specific aspects
Aspect library for product-line B
weave
Aspect library for product-line A
UML diagrams
Aspects are useful for product-line engineering
in which a variety of PSMs are generated from a
single set of PIMs.
294. Related work
30Related work
Aspect-oriented domain modeling (AODM) J.Gray
et. al. 2003
AODM introduced a language called ECL that
provides facilities for adding model elements
such as attributes and relations.
Persistence as an Aspect A.Rashid and
R.Chitchyan 2003
Aspect-oriented mechanisms ( reflection) for
describing database concerns are proposed.
QVT OMG
QVT (Queries, Views, and Transformations) is a
model transformation language.
Draco J. Neighbors 1984
In Draco, software development processes were
considered as a series of transformations.
315. Conclusion
32Conclusion
- We propose a method for model evolution using an
extensible model compiler based on aspect
orientation. - A modeler can extend model transformation rules
by defining new aspects in the process of
modeling.
33Appendix
34Discussion-- Aspect-orientation vs. meta
programming
- Someone might claim that AspectM is not an
aspect-oriented language but a meta language for
model transformations. - AspectM can describe not only model
transformation concerns but also ordinary
crosscutting concerns such as logging. - AspectM unifies (lightweight) meta-programming
with ordinary aspect-orientation by extending the
idea of JPMs.
lightweight meta-programming
aspect-orientation
JPMs