slide

MACS 2005
First International Workshop on the
Modeling and Analysis of Concerns in Software
Concern Management for
Constructing Model Compilers
-- Towards effective MDA
Naoyasu Ubayashi (Kyushu Institute of Technology)
Tetsuo Tamai
(University of Tokyo)
Shinji Sano, Yusaku Maeno, Satoshi Murakami (Kyushu Institute of Technology)
16 May 2005
1
Overview
1.
2.
3.
4.
5.
6.
7.
MDA and model compiler
Motivation
AspectM : Aspect-oriented modeling language
Constructing a model compiler using AspectM
Discussion
Related work
Conclusion
2
1. MDA and model compiler
MDA and model compiler
OOSD
MDA
Analysis
CIM
PIM
Design
PSM
Coding
Source code
model compiler
We can regard PIMs as new
kinds of reusable software
components because they can
be reused even if a platform is
changed.
MDA: Model-Driven Architecture
PIM: Platform Independent Model
CIM: Computation Independent Model PSM: Platform Specific Model
3
1. MDA and model compiler
Example of Model Transformation
Platform: Struts
Step1: merge PIMs
1) merge PIM classes
platform concerns crosscut
over model elements
PIM
PSM
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
Step 3: create an action class
5)
6)
7)
8)
create an action class
inherit Action
add execute method
add a method body
4
2. Motivation
Motivation
-- for constructing an effective model compiler
Multiple concerns

We need to take account of not only platform concerns but
also other kinds of model transformation concerns including
optimization, real-time constraints, and deployment.
Extensibility

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.
5
2. Motivation
Our Approach



We propose a method for constructing an extensible model
compiler based on aspect-orientation.
Aspect-orientation is useful for platform descriptions
because they crosscut over many model elements.
A modeler can extend model transformation rules by
defining new aspects in the process of modeling.
Aspect
Aspect
UML model
UML model
PIM
UML model
weave
Extensible model compiler
UML model
PSM
6
3. AspectM
Aspect-orientation
at the modeling-level (example)
join point
(class)
classA
attributes
operations
pointcut
classA || classB
(extract join point
whose name is
classA or classB)
advice
add new attributes
add new operations
classA
attributes
new attributes
operations
new operations
classB
join point
(class)
classC
attributes
attributes
classB
attributes
operations
new attributes
join point
(class)
operations
new operations
operations
Extension of JPMs (Join Point Models) in AOP
7
3. AspectM
JPMs for model transformations
transformation type
PA
change a method body
○
merge classes
add/delete classes
CM
NE
OC
RN
RL
1)merge PIM classes
CM
2) change the name ofmerged class
RN
○
3) inherit ActionForm
○
RL
add/delete operations
○
add/delete attributes
○
4) add setter/getter
OC
5) create an action class
rename classes
○
rename operations
○
6) inherit Action
rename attributes
○
7) add execute method
NE
RL
add/delete inheritances
○
add/delete aggregations
○
add/delete relationships
○
OC
8) add a method body
PA
PA(pointcut & advice),CM(composition),NE(new element),
OC(open class),RN(rename),RL(relation)
8
3. AspectM
JPMs for dealing with multiple
model transformation concerns
JPM
Join point
Pointcut
PA
operation
before,
after,
around
CM
class
merge-by-name
NE
class-diagram
OC
class
RN
class, operation, attribute
rename
RL
class
add-inheritance,
delete-inheritance,
add-aggregation,
delete-aggregation,
add-relationship,
delete-relationship9
Example
1) setX || setY
2) set*
3) classA || classB
4) class*
Advice
add-class
delete-class
add-operation,
delete-operation,
add-attribute,
delete-attribute
3. AspectM
AspectM




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.
10
3. AspectM
Example of AspectM descriptions
aspect
<< CM >>
mergeClasses
Step1: merge PIMs
inputClasses : class
{ pointcut-body=“cname(Message)
|| cname(MessageProfile)” }
Step 2: transform the merged class
to an action form bean class
merge [inputClasses] : merge-by-name
{ advice-body=“PostMessage” }
Step 3: create an action class
<aspect name=“mergeClasses” type=“ordinary” jpm=“CM" >
<pointcut name=“inputClasses” type=“class”>
<pointcut-body> cname(Message) || cname(MessageProfile) </pointcut-body>
</pointcut>
<advice name=“merge” type=“merge-by-name” ref-pointcut=“inputClasses”>
<ref-pointcut> message-classes </ref-pointcut>
<advice-body> PostMessage </advice-body>
</advice>
</aspect>
11
4. Constructing a model compiler
Implementation of model compiler
Model Compiler
XSLT style sheet
for
converting aspect (XML)
to XSLT style sheet
Aspect diagram
(XML)
XSLT processor
XSLT style sheet
for
converting UML (XML)
to UML (XML)
XSLT processor
UML diagram
(XML)
The first
transformation phase
The second
transformation phase
UML diagram
(XML)
12
4. Constructing a model compiler
Dealing with multiple concerns
concern for
merging models
concern for
optimizing
memory usage
concern for
logging
<aspect name=“mergeClasses” type=“ordinary” jpm=“CM" >
<pointcut name=“inputClasses” type=“class”>
<pointcut-body> cname(Message) || cname(MessageProfile) </pointcut-body>
</pointcut>
<advice name=“merge” type=“merge-by-name” ref-pointcut=“inputClasses”>
<ref-pointcut> message-classes </ref-pointcut>
<advice-body> PostMessage </advice-body>
</advice>
</aspect>
<aspect name=“deleteAttribute“ type="ordinary" jpm="OC">
<pointcut name="postMessageClass" type="class">
<pointcut-body>cname(PostMessage)</pointcut-body>
</pointcut>
<advice name="deleteDate" adviceType="delete-attribute“
ref-pointcut="postMessageClass">
<advice-body>date</advice-body>
</advice>
</aspect>
<aspect name="loggingSetter" type="ordinary" jpm="PA">
<pointcut name="allSetter" type="method">
<pointcut-body>oname(set*)</pointcut-body>
</pointcut>
<advice name="logSetter" adviceType="before“ ref-pointcut="allSetter">
<advice-body>Log.write()</advice-body>
</advice>
</aspect>
A modeler can extend model transformation rules by defining new aspects in the
process of modeling.
13
4. Constructing a model compiler
Towards product-line engineering
defined by modelers
Aspect library
for other platforms
Product X
:
Aspect library
for .NET
Aspect library
for J2EE
weave
Aspect library
for other product-lines
Aspect library
for product-line A
UML diagrams
Product Y
:
Aspect library
for product-line B
Application-specific
aspects
weave
Application-specific
aspects
UML diagrams
Aspects are useful for product-line engineering in which a
variety of PSMs are generated from a single set of PIMs.
14
5. Discussion
Discussion
-- Aspect-orientation vs. meta programming



Someone might claim that AspectM is not an aspectoriented 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.
aspect-orientation
JPMs
lightweight
meta-programming
15
6. Related work
Related 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.
16
7. Conclusion
Conclusion


We proposed a method for
constructing an extensible model
compiler that can deal with multiple
model transformation concerns.
A modeler can extend model
transformation rules by defining new
aspects in the process of modeling.
17