model transformation techniques (or: why i'd like write programs that write programs rather...

60
Model Transformation Model Transformation Techniques Techniques (or: Why I'd like write programs that write programs (or: Why I'd like write programs that write programs rather than write programs) rather than write programs) Prof. Jean-Marc Jézéquel (Univ. Rennes 1 & INRIA) Triskell Team @ IRISA Campus de Beaulieu F-35042 Rennes Cedex Tel : +33 299 847 192 Fax : +33 299 847 171 e-mail : [email protected] http://www.irisa.fr/prive/jezequel

Upload: liliana-shepherd

Post on 26-Dec-2015

226 views

Category:

Documents


0 download

TRANSCRIPT

Model Transformation TechniquesModel Transformation Techniques (or: Why I'd like write programs that write programs (or: Why I'd like write programs that write programs

rather than write programs)rather than write programs)

Prof. Jean-Marc Jézéquel(Univ. Rennes 1 & INRIA)

Triskell Team @ IRISACampus de Beaulieu

F-35042 Rennes CedexTel : +33 299 847 192 Fax : +33 299 847 171

e-mail : [email protected]

http://www.irisa.fr/prive/jezequel

© J.-M. Jézéquel, 2005 4

Modeling Modeling andand WeavingWeaving

DesignModel

Use CaseModel

SecurityModel

QoSModel Business

Model

ObjectModel

TestModel

UIModel

PlateformeModel

CodeModel

tester

Challenges:-Automatic Weaving-Product Lines-Reuse design know- how reified as Model Transformations

Challenges:-Automatic Weaving-Product Lines-Reuse design know- how reified as Model Transformations

© J.-M. Jézéquel, 2005 5

Model-to-Text vs. Model-to-ModelModel-to-Text vs. Model-to-Model Model-to-Text TransformationsModel-to-Text Transformations

– For generating: code, xml, html, doc. For generating: code, xml, html, doc. – Should be limited to syntactic level transcodingShould be limited to syntactic level transcoding

Model-to-Model TransformationsModel-to-Model Transformations– PIM to PSM a la OMG MDAPIM to PSM a la OMG MDA– Refining modelsRefining models– Reverse engineering (code to models)Reverse engineering (code to models)– Generating new viewsGenerating new views– Applying design patternsApplying design patterns– Refactoring modelsRefactoring models– Deriving products in a product lineDeriving products in a product line– … … any model engineering activity that can be automated…any model engineering activity that can be automated…

© J.-M. Jézéquel, 2005 6

Model-to-Text ApproachesModel-to-Text Approaches For generating: code, xml, html, doc. For generating: code, xml, html, doc.

– Visitor-Based Approaches: Visitor-Based Approaches: » Some visitor mechanisms to traverse the internal representation Some visitor mechanisms to traverse the internal representation

of a model and write code to a text streamof a model and write code to a text stream» Iterators, Write ()Iterators, Write ()

– Template-Based ApproachesTemplate-Based Approaches» A template consists of the target text containing slices of meta-A template consists of the target text containing slices of meta-

code to access information from the source and to perform text code to access information from the source and to perform text selection and iterative expansionselection and iterative expansion

» The structure of a template resembles closely the text to be The structure of a template resembles closely the text to be generatedgenerated

» Textual templates are independent of the target language and Textual templates are independent of the target language and simplify the generation of any textual artefactssimplify the generation of any textual artefacts

© J.-M. Jézéquel, 2005 7

Transformation ArchitectureTransformation Architecture

Transformation

Meta-model A

Model A

Conforms To

Meta-model B

Model B

Conforms To

Apply Transformation

Define Transformation

© J.-M. Jézéquel, 2005 8

Model-to-Model: Typical ExampleModel-to-Model: Typical Example

From UML to RDBMS

Transformation

© J.-M. Jézéquel, 2005 9

Element stereotype

Design pattern application(parametric collaboration)

…and alsoTagged values& Contracts

Command pattern

receiver

invoker

M2M: Reuse Engineering Know-M2M: Reuse Engineering Know-How (Design/Test/…)How (Design/Test/…)

© J.-M. Jézéquel, 2005 10

The resultThe result we we wanwantt : : design patterns applicationdesign patterns application

© J.-M. Jézéquel, 2005 11

Why complex transformations?Why complex transformations? Example: Air Traffic ManagementExample: Air Traffic Management

– ““business model” quite stable & not that complexbusiness model” quite stable & not that complex Various modeling languages used beyond UMLVarious modeling languages used beyond UML

– As many points of views as stakeholdersAs many points of views as stakeholders Deliver software for (many) variants of a platformDeliver software for (many) variants of a platform

– Heterogeneity is the ruleHeterogeneity is the rule Reuse technical solutions across large product Reuse technical solutions across large product

lines (e.g. fault tolerance, security…)lines (e.g. fault tolerance, security…) Customize generic transformationsCustomize generic transformations Compose reusable transformationsCompose reusable transformations Evolve & maintain transformations for 15+ years!Evolve & maintain transformations for 15+ years!

© J.-M. Jézéquel, 2005 12

Classification of Classification of Model Transformation TechniquesModel Transformation Techniques

1.1. General purpose programming languagesGeneral purpose programming languages– Java/C#...Java/C#...

2.2. Generic transformation toolsGeneric transformation tools– Graph transformations, XSLT…Graph transformations, XSLT…

3.3. CASE tools scripting languagesCASE tools scripting languages– Objecteering, Rose…Objecteering, Rose…

4.4. Dedicated model transformation toolsDedicated model transformation tools– OMG QVT styleOMG QVT style

5.5. Meta-modeling toolsMeta-modeling tools– Metacase, Xactium, Kermeta…Metacase, Xactium, Kermeta…

© J.-M. Jézéquel, 2005 13

1. General purpose language approach1. General purpose language approach

Java, VB, C++, C#,... Java, VB, C++, C#,... Your favorite Your favorite language!language!

Currently available in the tools via APIsCurrently available in the tools via APIs Rules and scheduling implemented Rules and scheduling implemented

from scratch using the programming from scratch using the programming languagelanguage

Example:Example:– JMI (MOF-compliant Java Interface)JMI (MOF-compliant Java Interface)

» JSR-000040 Java™ Metadata Interface JSR-000040 Java™ Metadata Interface

© J.-M. Jézéquel, 2005 14

JMI examplesJMI examplespackage javax.jmi.model;

import javax.jmi.reflect.*;

public interface Attribute extends StructuralFeature { public boolean isDerived(); public void setDerived(boolean newValue);} package javax.jmi.model;

import javax.jmi.reflect.*;

public interface Operation extends BehavioralFeature { public boolean isQuery(); public void setQuery(boolean newValue); public java.util.List getExceptions();}

Attributes

Operations

© J.-M. Jézéquel, 2005 15

General purpose language approach: General purpose language approach: ConclusionConclusion

No overhead to learn a new languageNo overhead to learn a new language Tool support to write the transformationsTool support to write the transformations

But wait:But wait:– We resort to modeling (before programming) for mastering We resort to modeling (before programming) for mastering

complexity, right?complexity, right?– Does it mean that transformations never get complex?Does it mean that transformations never get complex?

» Or that the problem only appears for non toy applications…Or that the problem only appears for non toy applications…

=> Monsieur Jourdain’s approach

© J.-M. Jézéquel, 2005 16

2. Generic transformation tools2. Generic transformation tools Awk-like (inc. Awk-like (inc. sed, perlsed, perl…) …)

XSLTXSLT

Graph Transformation toolsGraph Transformation tools

© J.-M. Jézéquel, 2005 17

Intermediate transformation languageIntermediate transformation language Typically XML basedTypically XML based

– But XML (XMI) is verboseBut XML (XMI) is verbose

XSLT can be used to transform XML trees into XSLT can be used to transform XML trees into other (XML) (trees)other (XML) (trees)– More batch than interactiveMore batch than interactive– Parameters are passed by valuesParameters are passed by values– XSLT transformations are not really easy to maintainXSLT transformations are not really easy to maintain

Better for simple transformationsBetter for simple transformations

© J.-M. Jézéquel, 2005 18

Example of XSLT transformation

If isSynchronou

s

Else

Do this

Do that

© J.-M. Jézéquel, 2005 19

Graph-Transformation-BasedGraph-Transformation-Based Declarative, based on the theoretical work on Declarative, based on the theoretical work on

graph transformationsgraph transformations– Operates on typed, attributed, labeled graphsOperates on typed, attributed, labeled graphs– Rule (LHS, RHS : Graph Pattern)Rule (LHS, RHS : Graph Pattern)– Automated source element selection, non-determinism in Automated source element selection, non-determinism in

scheduling and application strategyscheduling and application strategy Well known technology, albeit hard to masterWell known technology, albeit hard to master

» M. Andries, G. Engels, A. Habel, B. Hoffmann, H.-J. Kreowski, S. M. Andries, G. Engels, A. Habel, B. Hoffmann, H.-J. Kreowski, S. Kuske, D. Kuske, D. Plump, A. Schürr, and G. Taentzer. Graph Kuske, D. Kuske, D. Plump, A. Schürr, and G. Taentzer. Graph Transformation for Specification and Programming. Technical Transformation for Specification and Programming. Technical Report 7/96, Universität Bremen, 1996, see Report 7/96, Universität Bremen, 1996, see http://citeseer.nj.nec.com/article/andries96graph.html http://citeseer.nj.nec.com/article/andries96graph.html

© J.-M. Jézéquel, 2005 20

Generic transformation tools: Generic transformation tools: ConclusionConclusion

Awk-like (inc. Awk-like (inc. sed, perlsed, perl…) …)

XSLTXSLT– Good for syntactic transcoding, Good for syntactic transcoding,

not for semantic manipulations not for semantic manipulations

Graph Transformation toolsGraph Transformation tools– Powerfull, but complex because of the non-determinism in Powerfull, but complex because of the non-determinism in

scheduling and application strategyscheduling and application strategy– Require careful consideration of termination of the Require careful consideration of termination of the

transformation process and the rule application orderingtransformation process and the rule application ordering

SE Limit: ~100 LOC

SE Limit: ~1000 LOC

SE Limit: PhD needed!

© J.-M. Jézéquel, 2005 21

3. CASE tool scripting languages3. CASE tool scripting languages ArcstylerArcstyler from Interactive Objects from Interactive Objects

– MDA-Cartridge, JPython (Python & Java)MDA-Cartridge, JPython (Python & Java) ObjecteeringObjecteering from Objecteering Software from Objecteering Software

– J languageJ language OptimalJOptimalJ from Compuware from Compuware

– TPL languageTPL language FujabaFujaba (From UML to Java and Back Again) (From UML to Java and Back Again)

– Open Source Open Source ……

© J.-M. Jézéquel, 2005 22

CASE tools scripting languagesCASE tools scripting languages ProPro

– Good level of maturityGood level of maturity– Excellent integration with their CASE toolExcellent integration with their CASE tool

DrawbacksDrawbacks– Proprietary languages and/or tight coupling with the CASEProprietary languages and/or tight coupling with the CASE– Often developed as a second thought, not centralOften developed as a second thought, not central– Many limitations when model transformation get complexMany limitations when model transformation get complex

» Structuration, modularity, reuse problemStructuration, modularity, reuse problem» Configuration management issue when they need to be evolved Configuration management issue when they need to be evolved

and maintained for long periodsand maintained for long periods

© J.-M. Jézéquel, 2005 23

4. Dedicated Transformation 4. Dedicated Transformation LanguageLanguage

OMG QVT styleOMG QVT style– Kind of DSL for transformationKind of DSL for transformation

Simplify development and maintenance of Simplify development and maintenance of model-transformationsmodel-transformations

Higher expression powerHigher expression power Enhanced structurationEnhanced structuration

– Composition of rulesComposition of rules– InteroperabilityInteroperability

© J.-M. Jézéquel, 2005 24

MOF 2.0 Queries/Views/Transformations RFP

Define a language for querying MOF models Define a language for transformation definitions Allow for the creation of views of a model Ensure that the transformation language is

declarative and expresses complete transformations

Ensure that incremental changes to source models can be immediately propagated to the target models

Express all new languages as MOF models

© J.-M. Jézéquel, 2005 25

QueryQuery An expression evaluated over a modelAn expression evaluated over a model

– Returns one or more instances of types defined either in Returns one or more instances of types defined either in the source model or by the query languagethe source model or by the query language

OCL is an example of a query languageOCL is an example of a query language

© J.-M. Jézéquel, 2005 26

ViewView A view is a model that is completely derived A view is a model that is completely derived

from another modelfrom another model– The meta-model of the view is typically not the same as the The meta-model of the view is typically not the same as the

meta-model of the sourcemeta-model of the source

Model ViewTransformation

Meta-Model A Meta-Model A’

© J.-M. Jézéquel, 2005 27

TransformationTransformation A transformation generates target models A transformation generates target models

from source modelsfrom source models

TransformationTargetModel

SourceModel

May be bi-directional

© J.-M. Jézéquel, 2005 28

Q vs V vs TQ vs V vs T A query is a restricted kind of viewA query is a restricted kind of view

A view is a restricted kind of transformation A view is a restricted kind of transformation – The target model cannot be modified independently of the The target model cannot be modified independently of the

source modelsource model

A transformation generates target models A transformation generates target models from source modelsfrom source models

© J.-M. Jézéquel, 2005 29

ClassificationClassification Several approachesSeveral approaches

– Graph-transformation-based ApproachesGraph-transformation-based Approaches– Relational ApproachesRelational Approaches– Structure-Driven ApproachesStructure-Driven Approaches– Hybrid ApproachesHybrid Approaches

CommercialCommercial– Mia-Transformation (Mia-Software), PathMATE (Pathfinder Solutions)Mia-Transformation (Mia-Software), PathMATE (Pathfinder Solutions)

Many academic toolsMany academic tools– ATL & MTL (INRIA), AndroMDA, BOTL (Bidirectional Object oriented ATL & MTL (INRIA), AndroMDA, BOTL (Bidirectional Object oriented

Transformation Language),Coral (Toolkit to create/edit/transform new Transformation Language),Coral (Toolkit to create/edit/transform new models/modeling languages at run-time), Mod-Transf (XML and ruled based models/modeling languages at run-time), Mod-Transf (XML and ruled based transformation language), QVTEclipse (preliminary implementation of some ideas transformation language), QVTEclipse (preliminary implementation of some ideas of QVT in Eclipse) ou encore UMT-QVT (UML Model Transformation Tool)of QVT in Eclipse) ou encore UMT-QVT (UML Model Transformation Tool)

© J.-M. Jézéquel, 2005 30

DeclarativeDeclarative Declarative languages describe relationships Declarative languages describe relationships

between variables in terms of functions or between variables in terms of functions or inference rules and the language executor inference rules and the language executor (interpreter or compiler) applies some fixed (interpreter or compiler) applies some fixed algorithm to these relations to produce a algorithm to these relations to produce a resultresult

© J.-M. Jézéquel, 2005 31

ImperativeImperative Any programming language that specifies Any programming language that specifies

explicit manipulation of the state of the explicit manipulation of the state of the computer system, not to be confused with a computer system, not to be confused with a procedural languageprocedural language

© J.-M. Jézéquel, 2005 32

Declarative vs. Imperative StyleDeclarative vs. Imperative Style

Declarative (what to do)Declarative (what to do)– Invariant relations between source and target modelsInvariant relations between source and target models

Imperative (how to do it)Imperative (how to do it)– How to derive a target from a sourceHow to derive a target from a source

May be combined via pre- and post-conditionsMay be combined via pre- and post-conditions

Imperative RuleDeclarativePre-Condition

DeclarativePost-Condition

© J.-M. Jézéquel, 2005 33

Execution StrategyExecution Strategy Invocation of the transformation rulesInvocation of the transformation rules

– Explicit, via invocation operations (Java like)Explicit, via invocation operations (Java like)– Implicit, based on context and rules’ signature (Prolog like)Implicit, based on context and rules’ signature (Prolog like)

© J.-M. Jézéquel, 2005 34

TraceTrace Trace associates one (or more) target Trace associates one (or more) target

element with the source elements that lead element with the source elements that lead to its creationto its creation– For Round-trip developmentFor Round-trip development– Incremental propagationIncremental propagation

Rules may be able to match elements based Rules may be able to match elements based on the trace without knowing the rules that on the trace without knowing the rules that created the trace created the trace

© J.-M. Jézéquel, 2005 35

RuleRule Rules are the units in which transformations Rules are the units in which transformations

are definedare defined– A rule is responsible for transforming a particular selection A rule is responsible for transforming a particular selection

of the source model to the corresponding target model of the source model to the corresponding target model elements.elements.

© J.-M. Jézéquel, 2005 36

DeclarationDeclaration A declaration is a specification of a relation A declaration is a specification of a relation

between elements in the LHS and RHS between elements in the LHS and RHS modelsmodels

© J.-M. Jézéquel, 2005 37

ImplementationImplementation An implementation is an imperative An implementation is an imperative

specification of how to create target model specification of how to create target model elements from source model elementselements from source model elements– An implementation explicitly constructs elements in the An implementation explicitly constructs elements in the

target modeltarget model– Implementations are typically directedImplementations are typically directed

© J.-M. Jézéquel, 2005 38

MatchMatch A match occurs during the application of a A match occurs during the application of a

transformation when elements from the LHS transformation when elements from the LHS and/or RHS model are identified as meeting and/or RHS model are identified as meeting the constraints defined by the declaration of the constraints defined by the declaration of a rulea rule– A match triggers the creation (or update) of model elements A match triggers the creation (or update) of model elements

in the target modelin the target model

© J.-M. Jézéquel, 2005 39

IncrementalIncremental

A transformation is incremental if individual A transformation is incremental if individual changes in a source model can lead to changes in a source model can lead to execution of only those rules which match execution of only those rules which match the modified elementsthe modified elements

© J.-M. Jézéquel, 2005 40

M2M: Relational ApproachesM2M: Relational Approaches Declarative, based on mathematical relationsDeclarative, based on mathematical relations

– Good balance between flexibility and declarative expressionGood balance between flexibility and declarative expression

Implementable with logic programmingImplementable with logic programming– Mercury, F-Logic programming languagesMercury, F-Logic programming languages– Predicate to describe the relationsPredicate to describe the relations– Unification based-matching, search and backtrackingUnification based-matching, search and backtracking

© J.-M. Jézéquel, 2005 41

Example of logic programmingExample of logic programming Excerpt of Mercury codeExcerpt of Mercury code

© J.-M. Jézéquel, 2005 42

M2M : Structure-Driven ApproachesM2M : Structure-Driven Approaches

1st Phase1st Phase– Creation of hierarchical structure of target modelCreation of hierarchical structure of target model

2nd Phase2nd Phase– Set the attributes and references in the targetSet the attributes and references in the target

Users provide the transformation rulesUsers provide the transformation rules Framework determines the schedulingFramework determines the scheduling

© J.-M. Jézéquel, 2005 43

M2M : Structure-Driven ApproachesM2M : Structure-Driven Approaches

Pragmatic approaches developed in the Pragmatic approaches developed in the context of EJB and Databases schema context of EJB and Databases schema generation from UML modelsgeneration from UML models

Strong support for 1-to-1 and 1-to-n Strong support for 1-to-1 and 1-to-n correspondence between source and targetcorrespondence between source and target

Unclear how well these approaches can Unclear how well these approaches can support other kinds of applicationssupport other kinds of applications

© J.-M. Jézéquel, 2005 44

M2M : Hybrid Approaches - othersM2M : Hybrid Approaches - others

Any combination of different techniquesAny combination of different techniques

Practical approaches are very likely to have Practical approaches are very likely to have the hybrid characterthe hybrid character

© J.-M. Jézéquel, 2005 45

Dedicated model transformation Dedicated model transformation tools: Conclusiontools: Conclusion

How many developers are familiar with the How many developers are familiar with the prolog-like style of rules writing?prolog-like style of rules writing?

Where is the advantage of a dedicated Where is the advantage of a dedicated explicit language vs. a general purpose explicit language vs. a general purpose language?language?

Hybrid Languages or transformation libraries Hybrid Languages or transformation libraries for general purpose languages…for general purpose languages…

© J.-M. Jézéquel, 2005 46

5. Meta-modeling tools5. Meta-modeling tools Build (OO) Models of TransformationsBuild (OO) Models of Transformations Use MDE to run themUse MDE to run them

Commercial tools:Commercial tools:– MetaEdit+MetaEdit+ from MetaCase from MetaCase– XMF-MosaicXMF-Mosaic from Xactium from Xactium

Open-SourceOpen-Source– KerMeta from INRIA KerMeta from INRIA – www.kermeta.orgwww.kermeta.org

© J.-M. Jézéquel, 2005 47

General schemeGeneral scheme

Design Decisions(OO patterns e.g. template method…)

Pre-Design Decisions(OO frameworks)

Metamodels

ExecutableMeta-program

ModelMetamodels

MetamodelModelModel

ModelModelModel

© J.-M. Jézéquel, 2005 48

““Programming style” IssuesProgramming style” Issues The transformation is simply the model of an The transformation is simply the model of an

object-oriented program that manipulates object-oriented program that manipulates model elementsmodel elements– Navigation through model is first class though (like in OCL)Navigation through model is first class though (like in OCL)

OO techniquesOO techniques– Customizability through inheritance/dyn. bindingCustomizability through inheritance/dyn. binding– Pervasive use of GoF like Design PatternsPervasive use of GoF like Design Patterns

© J.-M. Jézéquel, 2005 49

Defining the metamodelsDefining the metamodels

© J.-M. Jézéquel, 2005 50

Visual / TextualVisual / Textual

package RDBMSMM;require kermetausing kermeta::standardclass Table{

attribute name : Stringattribute cols : Column[1..*]reference pkey : Column[1..*]attribute fkeys : FKey[0..*]

}class FKey{

reference references : Tablereference cols : Column[1..*]

}class Column{

attribute name : Stringattribute type : String

}class RDBMSModel{

attribute table : Table[1..*]}

© J.-M. Jézéquel, 2005 51

UML2RDBMS template methodUML2RDBMS template method Create tablesCreate tables

– Tables are created from classes marked as persistent in the input Tables are created from classes marked as persistent in the input modelmodel

Create columnsCreate columns– For each persistent class process all attributes and outgoing For each persistent class process all attributes and outgoing

associations to create corresponding columns. The foreign keys are associations to create corresponding columns. The foreign keys are created but the created but the cols cols property cannot be filled and the corresponding property cannot be filled and the corresponding columns cannot be created because primary keys of columns cannot be created because primary keys of referencesreferences table table cannot be known before it has been processed.cannot be known before it has been processed.

Update foreign-keysUpdate foreign-keys– The foreign-key columns are created in the table that contains the The foreign-key columns are created in the table that contains the

foreign-key and the property foreign-key and the property cols cols of foreign-keys is updated.of foreign-keys is updated.

=> Handle details/variability into subclasses

© J.-M. Jézéquel, 2005 52

package Class2RDBMS;require kermeta // The kermerta standard libraryrequire "trace.kmt // The trace frameworkrequire "../metamodels/ClassMM.ecore" // Input metamodel in ecorerequire "../metamodels/RDBMSMM.kmt“ // Output metamodel in kermeta[...]class Class2RDBMS { /** The trace of the transformation */ reference class2table : Trace<Class, Table>

/** Set of keys of the output model */ reference fkeys : Collection<FKey>[…]

Writing the transformationWriting the transformation

Loading ECore andKermeta metamodels

© J.-M. Jézéquel, 2005 53

operation transform(inputModel : ClassModel) : RDBMSModel is do // Initialize the trace class2table := Trace<Class, Table>.new class2table.create fkeys := Set<FKey>.new result := RDBMSModel.new // Create tables getAllClasses(inputModel).select{ c | c.is_persistent }.each{ c | var table : Table init Table.new table.name := c.name class2table.storeTrace(c, table) result.table.add(table) } // Create columns getAllClasses(inputModel).select{ c | c.is_persistent }.each{ c | createColumns(class2table.getTargetElem(c), c, "") } // Create foreign keys fkeys.each{ k | k.createFKeyColumns }

Create Tables

Create Columns

Update Foreign Keys

Trace Initialization

© J.-M. Jézéquel, 2005 54

Getting the input modelGetting the input model

© J.-M. Jézéquel, 2005 55

Executing the transformationExecuting the transformation

© J.-M. Jézéquel, 2005 56

Generated output modelGenerated output model

© J.-M. Jézéquel, 2005 57

Object-orientationObject-orientation Classes and relations, multiple inheritance, Classes and relations, multiple inheritance,

late binding, static typing, class genericity, late binding, static typing, class genericity, exception, typed function objects exception, typed function objects

OO techniques such as patterns, may be OO techniques such as patterns, may be applied to model transformationsapplied to model transformations– Template method as aboveTemplate method as above– Command, undo-redoCommand, undo-redo

» Refactorings exampleRefactorings example

abstract class RefactoringCommand{ operation check() : Boolean is

abstract operation transform() : Void is

abstract operation revert() : Void is abstract}

© J.-M. Jézéquel, 2005 58

CompositionComposition of transformationsof transformations Packages, classes, operations and methods, Packages, classes, operations and methods,

inheritance and late bindings inheritance and late bindings Rule recursivity is handled by function Rule recursivity is handled by function

recursivity recursivity

© J.-M. Jézéquel, 2005 59

Robustness and error handlingRobustness and error handling Kermeta is statically typed, and the code can Kermeta is statically typed, and the code can

be fully checked for correctness at be fully checked for correctness at compilation time. compilation time.

For unexpected behavior at runtime, the For unexpected behavior at runtime, the language provides exception handling. language provides exception handling.

© J.-M. Jézéquel, 2005 60

Design variations, libraries vs. DSLsDesign variations, libraries vs. DSLs

A final design reflects a set of tradeoffs A final design reflects a set of tradeoffs made by the developermade by the developer

The variation of the designs may be more or The variation of the designs may be more or less constraint by the amount of pre-design less constraint by the amount of pre-design and reuse provided by the language and reuse provided by the language environmentenvironment

© J.-M. Jézéquel, 2005 61

Software Engineering ConcernsSoftware Engineering Concerns Modularity in the small and the large Modularity in the small and the large

– classes & packagesclasses & packages ReliabilityReliability

– static typing, typed function objects and exception handling static typing, typed function objects and exception handling Extensibility and reuse Extensibility and reuse

– inheritance, late binding and genericityinheritance, late binding and genericity V & VV & V

– test casestest cases

© J.-M. Jézéquel, 2005 62

ConclusionConclusion Transformations are AssetsTransformations are Assets

– apply sound SE principles: apply sound SE principles: Modeling!Modeling!» from requirements, analysis, design, to implementation, V&V, and from requirements, analysis, design, to implementation, V&V, and

Configuration ManagementConfiguration Management Developing Model Transformations in-the-large is not Developing Model Transformations in-the-large is not

different from developing softwaredifferent from developing software– Unclear Requirements, Bugs, Unclear Requirements, Bugs, – Learning Curve (yet another language)Learning Curve (yet another language)

A specific language does not help much to address A specific language does not help much to address these generic SE issuesthese generic SE issues– Rely on proven techniques: OO languages, patterns, frameworksRely on proven techniques: OO languages, patterns, frameworks

Model-Driven Approach to Model Transformation