Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Model Compiler Construction Based on Aspect-oriented Mechanisms Naoyasu Ubayashi (Kyushu Institute of Technology) Tetsuo Tamai (University of Tokyo)

Similar presentations


Presentation on theme: "1 Model Compiler Construction Based on Aspect-oriented Mechanisms Naoyasu Ubayashi (Kyushu Institute of Technology) Tetsuo Tamai (University of Tokyo)"— Presentation transcript:

1 1 Model Compiler Construction Based on Aspect-oriented Mechanisms Naoyasu Ubayashi (Kyushu Institute of Technology) Tetsuo Tamai (University of Tokyo) Shinji Sano, Yusaku Maeno, Satoshi Murakami (Kyushu Institute of Technology) 29 September 2005 GPCE 2005 Generative Programming and Component Engineering

2 2 Overview  Motivation  AspectM  Model compiler construction using AspectM  Discussion  Related work  Conclusion

3 3 1. Motivation

4 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 platforms New requirements Optimization Multiple concerns!

5 5 How does MDA deal with this problem ? Analysis Design Coding CIM PIM PSM Source code MDA: Model-Driven ArchitecturePIM: Platform Independent Model CIM: Computation Independent ModelPSM: Platform Specific Model OOSDMDA model compiler We can regard PIMs as new kinds of reusable software components because they can be reused even if a platform is changed.

6 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 concerns Extensibility

7 7 Motivating example -- A simple bulletin board system

8 8 Example Original Platform Concern Optimization Concern make a product that is executable on the Struts platform optimize memory usage loggin g add a logging function for debugging loggin g modifications crosscut over many places Logging Concern delete application-specific

9 9 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 UML model weave Extensible model compiler UML model Aspect UML model PIM PSM AspectM

10 10 2. AspectM

11 11 Aspect orientation AOP is based on the JPM (Join Point Model). Join point Pointcut Advice 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

12 12 Aspect orientation at the modeling-level (example) classA attributes operations classB attributes operations classC attributes operations join point (class) classA || classB (extract join point whose name is classA or classB) pointcut classA attributes new attributes operations new operations advice add new attributes add new operations Extension of JPMs (Join Point Models) in AOP classB attributes new attributes operations new operations join point (class) join point (class)

13 13 JPMs for model transformations JPMJoin pointPointcutAdvice PAoperation Example 1) setX || setY 2) set* 3) classA || classB 4) class* before, after, around CMclass merge-by-name NEclass-diagramadd-class delete-class OCclassadd-operation, delete-operation, add-attribute, delete-attribute RNclass, operation, attribute rename RLclassadd-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 )

14 14 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.

15 15 Example of AspectM descriptions > addAttributeX classeAandB : class { pointcut-body=“cname(classA) || cname(classB)” } merge [classAandB] : add-attribute { advice-body=“attributeX” } aspect cname(classA) || cname(classB) attributeX classA classB classC classA new attributes advice add new attributes pointcut classA || classB classB new attributes

16 16 AspectM Tools UML diagrams Aspect diagrams Model Editor (Eclipse UML) AspectM metamodel (EMF) XMI (PIM) XMI XSLT style sheet XMI (PSM) XSLT style sheet Java code Model Compiler

17 17 AspectM metamodel

18 18 Implementation of model compiler Aspect diagram (XML) XSLT processor XSLT style sheet for converting aspect (XML) to XSLT style sheet XSLT style sheet for converting UML (XML) to UML (XML) UML diagram (XML) XSLT processor (Weaver) UML diagram (XML) The first transformation phase The second transformation phase Model Compiler

19 19 3. Model compiler construction using AspectM

20 20 Application-specific model compiler UML model Weaver (XSLT processor) Weaver (XSLT processor) UML model Aspect Extended application-specific model compiler

21 21 Example Original Platform Concern Optimization Concern make a product that is executable on the Struts platform optimize memory usage loggin g add a logging function for debugging loggin g Logging Concern delete application-specific

22 22 Aspect for platform concern > MergeClasses inputClasses : class { pointcut-body=“cname(Message) || cname(MessageProfile)” } merge [inputClasses] : merge-by-name { advice-body=“PostMessage” } aspect Step1: merge PIMs Step 2: transform the merged class to an action form bean class Step 2: transform the merged class to an action form bean class 1) merge PIM classes 2) change the name of merged class 3) inherit ActionForm 4) add setter/getter Platform: Struts

23 23 Component, Generics @input-classes@ @merged-class@ @input-classes@ @merged-class@ @merged-class@ concat( @merged-class@,"Form") concat( @merged-class@,"Form") Step1 Step2 component generics

24 24 Aspect for optimization concern <aspect name="DeleteAttribute" type="ordinary" jpm="OC"> <pointcut name="postMessageClass" type="class"> cname(PostMessage) <advice name="deleteDate" adviceType="delete-attribute" ref-pointcut="postMessageClass"> date > DeleteAttribute postMessageClasse : class { pointcut-body=“cname(PostMessage)” } merge [postMessageClasse] :delete-attribute { advice-body=“date” } aspect

25 25 Aspect for logging concern <aspect name="LoggingSetter" type="ordinary" jpm="PA"> <pointcut name="allSetter" type="method"> oname(set*) <advice name="logSetter" adviceType="before" ref-pointcut="allSetter"> Log.write() > LoggingSetter allSetter : method { pointcut-body=“oname(set*)” } merge [allSetter] : before { advice-body=“Log.write()” } aspect

26 26 Towards product-line engineering Aspects are useful for product-line engineering in which a variety of PSMs are generated from a single set of PIMs. Aspect library for.NET Aspect library for J2EE Aspect library for other platforms : Aspect library for product-line B Aspect library for product-line A Aspect library for other product-lines : Application-specific aspects UML diagrams defined by modelers Application-specific aspects UML diagrams Product X Product Y weave

27 27 4. Discussion

28 28 Scalability ? Aspect libraries that support de facto standard platforms such as J2EE and.NET. Aspect libraries that support platform- independent model transformations commonly applied to many applications. It is not realistic for a modeler to define all of the aspects needed to construct a model compiler from scratch. ① fusion of classes having certain kinds of patterns ② generation of setter/getter methods ③ change of naming conventions

29 29 Are six JPMs enough ? It is still not clear whether all kinds of model transformations can be described by the six JPMs. We think that there are situations for which new kinds of JPMs must be introduced. It would be better if a modeler can modify the AspectM metamodel using the model editor. This function can be considered as a modeling-level reflection, a kind of compile- time reflection.

30 30 Is AspectM really AOP language ? 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 lightweight meta-programming JPMs Someone might claim that AspectM is not an aspect- oriented language but a meta language for model transformations.

31 31 5. Related work

32 32 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. 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.

33 33 6. Conclusion

34 34 Conclusion We proposed a method for constructing an extensible model compiler that can deal with application-specific model transformations. A modeler can extend model transformation rules by defining new aspects in the process of modeling.


Download ppt "1 Model Compiler Construction Based on Aspect-oriented Mechanisms Naoyasu Ubayashi (Kyushu Institute of Technology) Tetsuo Tamai (University of Tokyo)"

Similar presentations


Ads by Google