1 model evolution with aspect-oriented mechanisms naoyasu ubayashi (kyushu institute of technology)...
Post on 03-Jan-2016
215 Views
Preview:
TRANSCRIPT
1
Model Evolution with Aspect-oriented Mechanisms
Naoyasu Ubayashi (Kyushu Institute of Technology)Tetsuo Tamai (University of Tokyo)Shinji Sano, Yusaku Maeno, Satoshi Murakami (Kyushu Institute of Technology)
6 September 2005
IWPSE 2005International Workshop on Principles of Software Evolution
2
Overview
1. Motivation2. An extensible model compiler based
on AO3. Evolution based on extensible model
compiler4. Related work5. Conclusion
3
1. Motivation
4
Issues 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 platformsNew requirements
OptimizationEvolution!
5
How does MDA deal with this problem ?
Analysis
Design
Coding
CIM
PIM
PSM
Source code
MDA: Model-Driven Architecture PIM: Platform Independent ModelCIM: Computation Independent Model PSM: Platform Specific Model
OOSD MDA
model compilerWe can regard PIMs as new kinds of reusable software components because they can be reused even if a platform is changed.
6
But, …
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.
Multiple concernsMultiple concerns
ExtensibilityExtensibility
7
Motivating example -- A simple bulletin board system
8
Example of model evolutionOriginal First Version Second Version
Variation ofSecond Version
make a product that is executable on the Struts platform
optimize memory usage
logging
add a logging function for debugging
logging
modifications crosscut over many places
Platformconcern
Optimizationconcern
Loggingconcern
9
Our 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)
10
Extensible model compiler
AspectAspect
UML modelUML model weaveweave
Extensible model compilerExtensible model compiler
UML modelUML model
AspectAspect
UML modelUML model
UML modelUML model
AspectM
Using AspectM, a modeler can extend model transformation rules by defining new aspects in the process of modeling.
(ex. PIM) (ex. PSM)
Modeling
11
Evolution at the modeling level
Base Model
Model forProduct 1
Model forProduct 2
Model forProduct n
Model forProduct 1
Model forProduct 2
Model forProduct n
Ver.1
Ver.2
Version
Variation
model compilationusing aspects
model compilationusing aspects
12
Advantage 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.
13
2. An extensible model compiler based on AO
-- from our previous work
14
Aspect orientation
AOP is based on the JPM (Join Point Model).
Join pointJoin point
PointcutPointcut
AdviceAdvice
program execution points including method invocations and field access points
a means of extracting a set of join points related to a specific crosscutting concern from all join points
a means of raising effects at the join points
15
Aspect orientationat the modeling-level (example)
Extension of JPMs (Join Point Models) in AOP
classA
attributes
operationsclassB
attributes
operationsclassC
attributes
operations
join point
(class) classA || classB(extract join point whose name is classA or classB)
pointcut classA
attributesnew attributes
operationsnew
operations
adviceadd new attributesadd new operations
classB
attributesnew attributes
operationsnew
operations
join point
(class) join point
(class)
16
JPMs for model transformationsJPM Join point Pointcut Advice
PA operation
Example 1) setX || setY 2) set* 3) classA ||
classB 4) class*
before,after,around
CM class merge-by-name
NE class-diagram add-classdelete-class
OC class add-operation,delete-operation,add-attribute,delete-attribute
RN class, operation, attribute
rename
RL class add-inheritance,delete-inheritance,add-aggregation,delete-
aggregation,add-relationship,delete-relationship
PA ( pointcut & advice ), CM ( composition ), NE ( new element ), OC ( open class ), RN ( rename ),RL ( relation )
17
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.
18
Example of AspectM descriptions
<< OC >>addAttributeX
classeAandB : class { pointcut-body=“cname(classA) || cname(classB)” }
merge [classAandB] : add-attribute { advice-body=“attributeX” }
aspect
<aspect name=“addAttributeX” type=“ordinary” jpm=“OC" > <pointcut name=“classeAandB” type=“class”> <pointcut-body> cname(classA) || cname(classB) </pointcut-body> </pointcut> <advice name=“add-attributeX” type=“add-attribute” ref-
pointcut=“classAandB”> <advice-body> attributeX </advice-body> </advice></aspect>
classA
classB
classC
classA
newattributes
advice
add newattributes
pointcutclassA || classB
classB
newattributes
19
Implementation of model compilerAspect diagram
(XML)
XSLT processorXSLT style sheet
forconverting aspect (XML)
to XSLT style sheetXSLT style sheet
forconverting UML (XML) to UML (XML)
UML diagram (XML)
XSLT processor
UML diagram (XML)
The firsttransformation phase
The secondtransformation phase
Model Compiler
20
3. Evolution using extensible model compiler
21
Example of model evolutionOriginal First Version Second Version
Variation ofSecond Version
make a product that is executable on the Struts platform
optimize memory usage
logging
add a logging function for debugging
logging
modifications crosscut over many places
Platformconcern
Optimizationconcern
Loggingconcern
22
PIM PSM
Step1: merge PIMsStep1: merge PIMs
Step 2: transform the merged classto an action form bean class
Step 2: transform the merged classto an action form bean class
Step 3: create an action class
Step 3: create an action class
Model transformation for first version
1) merge PIM classes
2) change the name of merged class3) inherit ActionForm4) add setter/getter
5) create an action class6) inherit Action7) add execute method8) add a method body
Platform: Struts
platform concerns crosscut over model elements
23
Aspect for the first version
<< CM >>MergeClasses
inputClasses : class { pointcut-body=“cname(Message) || cname(MessageProfile)” }
merge [inputClasses] : merge-by-name { advice-body=“PostMessage” }
aspect Step1: merge PIMsStep1: merge PIMs
Step 2: transform the merged classto an action form bean class
Step 2: transform the merged classto an action form bean class
Step 3: create an action class
Step 3: create an action class
1) merge PIM classes
2) change the name of merged class3) inherit ActionForm4) add setter/getter
5) create an action class6) inherit Action7) add execute method8) add a method body
Platform: Struts
24
Component, Generics<aspect name="Generic-Classes2ActionFormBean" type="component">
<params> <param> @input-classes@ </param> <param> @merged-class@ </param> </params>
<aspect name="MergeClasses" template="Generic-MergeClasses"> <set-param name="@input-classes@"> @input-classes@ </set-param> <set-param name="@merged-class@"> @merged-class@ </set-param> </aspect>
<aspect name="SetActionFormBeanName" template="Generic-SetActionFormBeanName"> <set-param name="@class@"> @merged-class@ </set-param> </aspect>
<aspect name="InheritActionForm" template="Generic-InheritActionForm"> <set-param name="@sub-class@">concat( @merged-class@ ,"Form")</set-param> </aspect>
<aspect name="AddAccessors" template="Generic-AddAccessors"> <set-param name="@class@">concat( @merged-class@ ,"Form")</set-param> </aspect>
</aspect>
Step1
Step2
component
generics
25
Aspect for the second version
<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>
<< OC >>DeleteAttribute
postMessageClasse : class { pointcut-body=“cname(PostMessage)” }
merge [postMessageClasse] :delete-attribute { advice-body=“date” }
aspect
26
Aspect for a variation
<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>
<< PA >>LoggingSetter
allSetter : method { pointcut-body=“oname(set*)” }
merge [allSetter] : before { advice-body=“Log.write()” }
aspect
27
Model evolution (example)Original Model
Optimized Model for
Struts Platform
+ Logging
Model forStruts Platform
Ver.1
Ver.2
Version
AspectGeneric-
Classes2ActionFormBean
AspectDeleteAttrib
ute
Variation
Version
AspectLoggingSett
er
28
Towards product-line engineering
Aspects are useful for product-line engineering in which avariety of PSMs are generated from a single set of PIMs.
Aspect library
for .NETAspect libraryfor J2EE
Aspect libraryfor other platforms
:
Aspect libraryfor product-
line BAspect libraryfor product-
line A
Aspect libraryfor other product-lines
:
Application-specificaspects
UML diagrams
defined by modelers
Application-specificaspects
UML diagrams
Product X
Product Y
weave
weave
29
4. Related work
30
Related workAspect-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.
In Draco, software development processes were considered as a series of transformations.
Draco [J. Neighbors 1984]
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.
31
5. Conclusion
32
Conclusion
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.
33
Appendix
34
Discussion-- 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.
aspect-orientation
lightweightmeta-programming
JPMs
top related