tony clark kings college london, uk – [email protected] andy evans university of york, uk –...
Post on 21-Dec-2015
220 views
TRANSCRIPT
Tony ClarkKings College London, UK – [email protected]
Andy EvansUniversity of York, UK – [email protected]
Stuart KentUniversity of Kent at Canterbury, UK – [email protected]
September 2001
precise UML (pUML) group
www.puml.org
Realising MDA –a Precise Metamodeling Approach
AcknowledgementsSteve Cook, Desmond D’Souza, Steve Mellor
© Clark, Evans, Kent, September 2001 2
Outline MDA
Modeling space Metamodeling space
Language engineering – precise meta-modeling approach Three principles and techniques Excerpts from the 2U submission
Tools Tool demonstration Future developments
Transformations Importance of transformations The relation template Example mappings
Conclusions & Discussion
© Clark, Evans, Kent, September 2001 3
platform
business
platform specificimplementation
of system(s)
business model
platformindependent model
of system(s)
separationof concerns
time
MDA – modeling space 1
© Clark, Evans, Kent, September 2001 4
MDA – platform independence
business model
supporting systems
•Technology independent•Domain expert oriented
•Involves a range of technologies•Intermixed with manual processes•Business processes and rules scattered and implicit
Architecture, patterns, templates
currentpractice
paperware
© Clark, Evans, Kent, September 2001 5
MDA – platform independence
business model
supporting systems
•Technology independent•Domain expert oriented
•Involves a range of technologies•Intermixed with manual processes•Business processes and rules scattered and implicit
Architecture, patterns, templates
futurepractice
precise models,templates &patterns
code/test generationtraceability management
tools chain
© Clark, Evans, Kent, September 2001 6
MDA scenario – b2c
TESTS ?
UML Spec ModelUML Impl Model
dbset up
.htmlcgi
script
Platform 1
.php
Platform 2UML Spec ModelUML Impl Model
= extension
= refinement
Platform 3
.jsp
.java(with
embeddedsql)
javacompilation
script javainterface to
legacy wrapper
= translation
© Clark, Evans, Kent, September 2001 7
customer ordering
order fulfilment
orders
separationof concerns
platform
business
time
MDA – modeling space 2
© Clark, Evans, Kent, September 2001 8
MDA – Model Separation and Composition
Compose generated and non-generated models
Build consistently architected systems from components Specialize and Configure Generate plug-ins, bridges, adaptors Connect together
Example inspired by Kevin Tyson
Futures Trading(commodity, payment)
Consumption(consumable, …)
generate: electricity, water futures electricity, water futures
compose with …
Precise templates of domains and business processes Futures Trading – orange juice, pork bellies, … electricity, drinking water? Consumption – auto parts, … orange juice, pork bellies, … electricity, drinking water?
Generate models from templates specialized with domain specifics Futures Trading [ electricity / commodity, drinking water futures / payment ] Consumption [ futures electricity purchase / consumable ]
© Clark, Evans, Kent, September 2001 9
time
version 2
version 1
platform
business
separationof concerns
version 2
version 1
MDA – modeling space 3
© Clark, Evans, Kent, September 2001 10
MDA – Need for tools Problems with modeling on an industrial scale:
tests/inspections/proofs of large models? validation… do the models support the business well? code & test generation to different platforms?
A lesson from eXtreme programming (XP) forget paperware… focus only on stuff that executes (automated) testing refactoring responsive to change
XP works on homogeneous systems written in one language & environment
MDA abstracts from heterogeneous environment to homogeneous environment abstractions are closer to business model tools required to move X practices to MDA
© Clark, Evans, Kent, September 2001 11
platform
business
tool
language definition
separationof concerns
time
MDA – metamodeling space 1
© Clark, Evans, Kent, September 2001 12
separationof concerns
platform
business
time
syntax
specification
instance
XML
concepts
syntax
conceptssyntaxsyntax
semantics
MDA – metamodeling space 2
© Clark, Evans, Kent, September 2001 13
MDA – Defining a Family of Languages Precise templates for the domains of language definition
Concrete notation Abstract syntax Instances Mappings between these
Classes
Specification
Instances
Namespaces Instance
class attrib object slot
generate: , class, attribute object, slot
compose with …
Generate models of languages (or fragments) from these templates Classes, attributes Objects, slots
Compose fragments
Build consistently architected language family Even including relationships across
languages
© Clark, Evans, Kent, September 2001 14
MDA – metamodeling space 3time
version 2
version 1
platform
business
separationof concerns
version 2
version 1
© Clark, Evans, Kent, September 2001 15
Rate of change
Tools that support exploration of specifications through instances Permits automated testing of specs (programs or models)
A tool implementing a language 4 defining languages can be used to generate tools to support particular languages
all the time hardly ever
instancesfilmstrips
traces
language 4 defininglanguages
specifications
PIMsUML models
PSMsprograms
languagedefinition
s
© Clark, Evans, Kent, September 2001 16
Metatools Don’t live in a world of fixed languages
different domains use different modeling patterns (architectures) some can be captured by templates, others need domain specific
languages (DSLs)
But, if modeling is to be used in anger we need tools tools need to be modeling language specific (both PS and PI) main ‘brake’ is time-to-market of tools
Metatools generate tools from language definitions through interpretation or compilation still a long way to go
Metatools would admit opportunistic invention of DSLs opportunistic identification and definition of patterns more powerful than templates
© Clark, Evans, Kent, September 2001 17
Example metatools MOF – www.omg.org MetaEdit+ – www.metacase.com Dome – www.htc.honeywell.com/dome/ XML – www.w3c.org PROGRESS – graph grammars MMT
© Clark, Evans, Kent, September 2001 18
Outline MDA
Modeling space Metamodeling space
Language engineering – precise meta-modeling approach Three principles and techniques Excerpts from the 2U submission
Tools Tool demonstration Future developments
Transformations Importance of transformations The relation template Example mappings
Conclusions & Discussion
© Clark, Evans, Kent, September 2001 19
Three Principles
Generative Architecture ensures consistency avoids duplication easily re-factored
Unambiguous Language verifiable models translatable models richer tool support
Layered Definitions pluggable definitions extensible definitions composition avoids errors
ConsistentCore
© Clark, Evans, Kent, September 2001 20
Three Techniques
Package Templates ensures consistency avoids duplication easily re-factored
Instance Constraints verifiable models translatable models richer tool support
Package Generalization pluggable definitions extensible definitions composition avoids errors
ConsistentCore
© Clark, Evans, Kent, September 2001 21
T1(X,Y,Z)
XhasDistinguished<Z>():
Boolean
Y
Z<x>s*
<y>*
<x>s* <z> 1
distinguished<Z>0..1
<y>1
<z>Elements
*
hasDistinguished<Z>()distinguished<Z>->notEmpty
inv: <z>Elements->includes(distinguished<Z>)inv: <z>Elements = <x>s.<z>
P
name:String
B
P
AhasDistinguishedC():
Boolean
name:String
B
Cas*
b*
as* c 1
distinguishedC0..1
b1 cElements
*
hasDistinguishedC()distinguishedC->notEmpty
inv: cElements->includes(distinguishedC)inv: cElements = as.c
[A / X, B / Y, C / Z]
Apply Template
© Clark, Evans, Kent, September 2001 22
T1(X,Y,Z)
T2(X,Y)
hasDistinguished<Y>():Boolean
X
Ydistinguished<Y>
0..1
<x>1
<y>Elements
*
hasDistinguished<Y>()distinguished<Y>->notEmpty
inv: <y>Elements->includes(distinguished<Y>)
T3(X,Y,Z)
X Y Z<x>s*
<y>*
<x>s* <z> 1
<y>
1
<z>Elements
*
inv: <z>Elements = <x>s.<z>
hasDistinguished<Z>():Boolean
Y
Zdistinguished<Z>
0..1
<y>1
<z>Elements
*
hasDistinguished<Z>()distinguished<Z>->notEmpty
inv: <z>Elements->includes(distinguished<Z>)
X<x>s*
<y>*
<x>s* <z> 1
inv: <z>Elements = <x>s.<z>
[X / X, Y / Y, Z / Z][Y / X, Z / Y]
Merge Templates
© Clark, Evans, Kent, September 2001 23
R
P
a:Xb:Y
A X
Y
X
Ya:Xb:Y
A
Q
a:Xc:Z
A X
Z
Z
a:Xb:Yc:Z
A
C
PackageGeneralization
© Clark, Evans, Kent, September 2001 24
Structured Language Definition: Java
class A extends B
{ int I;
m () { …. }
}
– every instance of A will …
– when class A is loaded, a new class object …
T x = new A(p); – matching constructor available, return value type T match
– new instance of A created and variable x is bound to it
Specification: rules about well-formed expressions
Instance/Example: rulesabout valid instances
Language Element
– class needs valid identifier name, can extend 0..1 class, has instance variables …
© Clark, Evans, Kent, September 2001 25
Structured Language Definition: UML
– every object of class Dog has slots name, breed, weight
– every slot has a value of the type of the corresponding attribute
– Each binary association links two classes. Each association has a multiplicity string…
– Association is drawn as a line joining classes
– An instance of the association (a link) links a specific instance of Dog, Sarzak, to a specific instance of owner, Sally
– The “dog owner” John owns no dogs
– Every valid example …
Specification: rules about well formed models
Instance/(Counter)ExampleLanguage Element
Dog
NameBreedWeight
Dog
NameBreedWeightOwner
Dog Owner
NameAddress{Dogs}
1
1 .. *
A counter-example discovered during instance modeling
– Class contains attributes; Attributes have distinct names
– Attributes are in middle compartment
© Clark, Evans, Kent, September 2001 26
How abstract syntax constrains instances–Java: instantiation, binding, execution–UML: instantiation, deletion, query, computation
To Define a Language …
Specification: abstract syntax for expressions–Java: class, variable, statements, constructors, …–UML: Class, Attribute, Association
Notation: concrete syntax for expressions–Java: strings, parentheses, …–UML: boxes, lines, text strings
Instances that are described by expressions–Java:objects, method invocations, threads, …–UML: Objects, Slots, Links
Concrete syntax to / from abstract syntax–Java: strings to tokens to abstract syntax trees–UML: boxes to classes, lines to associations, …
© Clark, Evans, Kent, September 2001 27
Cover All 4 Aspects Of Language Definition
Specification Instance/(Counter)ExampleConcepts class, attribute object, link(abstract syntax) expression calculation
interaction trace Notation box box(concrete syntax) collaboration diagram line
collaboration diagram
From the RFP… “Proposals shall enforce a clear separation of concerns between the specification of the metamodel
semantics and notation, including precise bi-directional mappings between them.” “Proposals should stipulate the mechanisms by which compliance to the specification will be
determined…”
MDA requires that PSM implementations be testable against PIM specs Need to know what a PIM specifies about instance behavior (Plus the relation between PIM instances (data types, exceptions, slots) and PSM ones)
We want tools that do much more than in the recent past Instance level exploration is key to understanding, debugging, testing, …
© Clark, Evans, Kent, September 2001 28
Federated tools: integration, interoperability
Architecture of language = architecture of tools
specification
concepts
instance
visualiser
texttools
instancechecker
instancegenerator
diagrameditor
xmltools
textparser
textgenerator
xmltools
repositorymanagement
versioncontrol
concepts
layoutengine
Body of examples & counter examples – tests
specification
Translator,Traceability manager
© Clark, Evans, Kent, September 2001 29
2U Submission Architecture
UML2.StaticCore
Classes
Expressions
Packages
DataTypes
Queries
Associations
Reflection
Templates Constraints
UML2.DynamicCore
UML2.TemplateLibrary
UML2.OCLUML2.Superstructure
[substitute dynamic elements]
[substitute static elements][substitute superstructure elements]
[substitute ocl elements]
Note: Picture in initial submission document is incomplete
© Clark, Evans, Kent, September 2001 30
Compare with……current architecture of UML / MOF
UML 1.x (concepts)
UMLcore
UML 1.x“physical meta-model”
MOF
CWM
maps
extends
OCL
instantiates
uses
usesXMI, IDLdefinesProfile
adapted from a slide by Steve Cook
subsets/extends
© Clark, Evans, Kent, September 2001 31
syntax
2-waymapping
KEY
UML_2
UML_Language_Unit
specification
instance
XML
concepts
syntax
conceptssyntaxsyntax
semantics
equivalent toabstract syntax
Separation of concerns
© Clark, Evans, Kent, September 2001 32
Package UML2.StaticCore: focus on Classes
UML2.StaticCore
Classes Expressions
Packages
DataTypes
Queries
Associations Reflection Templates Constraints
© Clark, Evans, Kent, September 2001 33
Portion of UML2 Template Library
© Clark, Evans, Kent, September 2001 34
GeneralisableRelated1Semantics
GeneralisableFeatureContainer
Semantics
[Class_ / Container,Attribute_ / Contained,Object_ / ContainerInstance,Slot_ / ContainedInstance]
Classes
AbstractSyntax SemanticDomain
SemanticMapping
[Attribute_ / Element1,type / name1,Class_ / Element2,Slot__ / Element1Instance,value / name2,Object_ / Element2Instance]
Generate StaticCore.Classes from Templates: 1UML2.StaticCore
Classes Expressions
Packages
DataTypes
Queries
Associations Reflection Templates Constraints
© Clark, Evans, Kent, September 2001 35
GeneralisableContainerSemantics(Container,Contained,ContainerI
nstance,ContainedInstance)
AbstractSyntax SemanticDomain
<Container>
<Contained>
<ContainerInstance>
<ContainedInstance>
ContainerSemantics()
GeneralisableSemantics()
[<Container>/ModelClass,<ContainerInstance>/InstanceClass]
[<Contained>/ModelClass,<ContainedInstance>/InstanceClass]
SemanticMapping
<Container><ContainerInstance>
instancesof
<Contained><ContainedInstance>instancesof
<Container><ContainerInstance>
<Contained>s<ContainedInstance>s
parents
parents
parents
parents
GeneralisableContainer()
[<Container>/Container,<Contained>/Contained]
[<ContainerInstance>/Container,<ContainedInstance>/Contained]
11
1
1
* *
*
*
GeneralisableFeatureContainer
Semantics()
Just addssimple constraint
Instances of a generalisable element can be viewed as different types
Instances of any container will containinstances of the container’s contents
A container whose contents are calculated from locally introducedcontents and from its parents’ contentsand which applies the namespace pattern
Easy step to rule on naming:<X> , <X>Instance
© Clark, Evans, Kent, September 2001 36
GeneralisableRelated1Semantics
GeneralisableFeatureContainer
Semantics
[Class_/Container,Attribute_/Contained,Object_/ContainerInstance,Slot_/ContainedInstance]
Classes
AbstractSyntax SemanticDomain
SemanticMapping
[Attribute_/Element1,type/name1,Class_/Element2,Slot__/Element1Instance,value/name2,Object_/Element2Instance]
Generating StaticCore.Classes from Templates: 2If - elements E1 and E2 are related by name1-and each element is generalizableThen-each E1’s parents must be related (name1) to theparents of its corresponding E2s-E1’s instances must be related (name2) to the parentsof the corresponding (name2) E2’s instances-E1’s instances can be viewed as of type E1 or of type any of E1’s transitive parents-Similarly for E2See Template 4.16 for full model
UML2.StaticCore
Classes Expressions
Packages
DataTypes
Queries
Associations Reflection Templates Constraints
© Clark, Evans, Kent, September 2001 37
Generated StaticCore.Classes: 1 of 3
Class has namespace for its attributes (alternative: parametric inheritance) Classes are generalizable (have parents) Attributes are generalizable (have parents) All OCL constraints and query expressions generated as well
© Clark, Evans, Kent, September 2001 38
Generated StaticCore.Classes: 2 of 3
Objects have slots, whose values are objects Since Classes are generalizable, objects can be viewed as being of
different classes (parents link) Note: In document, “Object” might be better named “ObjectView”; and ID might
be better named “Object” Since Attributes are generalizable, slots can be viewed as being of different
attributes
© Clark, Evans, Kent, September 2001 39
Generated StaticCore.Classes: 3 of 3
Instance constraints between objects/slots and classes/attributes Associations generated OCL constraints generated
© Clark, Evans, Kent, September 2001 40
Result of Our Approach
Consistent structure, constraints, names introduced at will
Architectural integrity maintained through all lower templates
Consistency assured in every end-model template application
Consistency assured across languages and profiles, across concrete syntax, abstract syntax, and instance domains
Changes made in just on place
Final submission will develop ContainerMap branch: basis for 1st class MDA support
© Clark, Evans, Kent, September 2001 41
More on templates from submission
© Clark, Evans, Kent, September 2001 42
Outline MDA
Modeling space Metamodeling space
Language engineering – precise meta-modeling approach Three principles and techniques Excerpts from the 2U submission
Tools Tool demonstration Future developments
Transformations Importance of transformations The relation template Example mappings
Conclusions & Discussion
© Clark, Evans, Kent, September 2001 43
Slides for tool demo
© Clark, Evans, Kent, September 2001 44
Outline MDA
Modeling space Metamodeling space
Language engineering – precise meta-modeling approach Three principles and techniques Excerpts from the 2U submission
Tools Tool demonstration Future developments
Transformations Importance of transformations The relation template Example mappings
Conclusions & Discussion
© Clark, Evans, Kent, September 2001 45
Transformations Everywhere! Language definition
Between languages Business models to PIMs PIMs to PSMs
Between models in the same language Refinement
Specification Instance/(Counter)ExampleConcepts class, attribute object, link(abstract syntax) expression calculation
interaction trace Notation box box(concrete syntax) collaboration diagram line
collaboration diagram
© Clark, Evans, Kent, September 2001 46
Relation template
<X> <X><Y> <Y>
image():Set(<Y>)inverseImage():Set(<X>)isFunctional():BooleanisInverseFunctional():BooleanisInjection():BooleanisOnto():BooleanisTotal():BooleanisBijection():Booleanlookup(x:<X>):Set(<X><Y>)lookup(y:<Y>):Set(<X><Y>)
<X>Rel<Y>
<y>_r
1
<x>_d
1
rel 1
pairs *dom * ran *
Relation(X,Y)
context <X>Rel<Y> inv:image()=pairs.<y>_r->asSet
inverseImage()=pairs.<x>_d->asSet
isFunctional()=pairs->forAll(p,q| p.<x>_d=q.<x>_d implies p=q)
isInverseFunctional()= pairs->forAll(p,q | p.<y>_r =q.<y>_r implies p=q)
isInjection()=isFunctional and isInverseFunctional
isOnto()=(image=ran)
isTotal()=(inverseImage=dom)
isBijection()=isInjection() and isOnto() and isTotal()
lookup(x)=pairs->select(p|p.<x>_d=x)
lookup(y)=pairs->select(p|p.<y>_r=y)
© Clark, Evans, Kent, September 2001 47
Semantics
© Clark, Evans, Kent, September 2001 48
Example PIM to PSM
© Clark, Evans, Kent, September 2001 49
Refinement Car hire example (rental action) Consider mapping of dynamic behaviour
© Clark, Evans, Kent, September 2001 50
Outline MDA
Modeling space Metamodeling space
Language engineering – precise meta-modeling approach Three principles and techniques Excerpts from the 2U submission
Tools Tool demonstration Future developments
Transformations Importance of transformations The relation template Example mappings
Conclusions & Discussion
© Clark, Evans, Kent, September 2001 51
Conclusions MDA needs languages
in familieseducation and trainingtooling
MDA needs advanced tools to explore models by example to check well-formedness to automate and track model transformations
MDA applied at the metamodeling level could deliver technology to generate tools from definitions
MDA needs an approach to metamodeling which delivers complete consistently architected unambiguous and machine processable
definitions of language families Transformations are critical
candidate for first class language support
© Clark, Evans, Kent, September 2001 52
Discussion If MDA is realised, what impact will it have?
On peopleanalysts, designers, engineers, programmers, …
On solutions for customersquality, costs, time-to-deployment, ongoing evolution, …
On margins for solution providersproductivity, tools, …
Are there other (non-technical?) things we should be doing that would have greater impact?