Object-Oriented Theories for Model Driven Architecture
-
Upload
neville-morton -
Category
Documents
-
view
30 -
download
4
description
Transcript of Object-Oriented Theories for Model Driven Architecture
Object-Oriented Theories for Model Driven Architecture
Tony Clark, King’s College, UK.Andy Evans, University of York, UK.Robert France, Colorado University,
USA.
Overview
• Requirements for MDA
• Language Engineering for MDA
• Technology for MDA:– Package Extension– Templates– Theories– Refinement and Refactoring
Model Driven Software Engineering
BusinessRules
SafetyRequirementsInformation
Model
FunctionalModel
DevelopmentProcess
Real-TimeRequirements Deployment
Model
EventModel
PlatformIndependent
ModelTests Analysis
PlatformSpecificModel
Mapping
PlatformSpecificModel
Mapping
Software systems:
• increasingly modelled
• need reuse of design/code
• require tool support
• faster delivery times
• skills shortage
• product lines
• more automation
• interoperability
• domain specific languages
Language Engineering for MDALanguage
Unit
ConcreteSyntax
AbstractSyntax
SemanticDomain
Parse/Display Semantics
LanguageUnit
LanguageMapping
LanguageUnit
LanguageUnit
Template Packages and Classes
• MML allows definitions to be parametric.
• OO Patterns can be defined as templates.
• Templates are stamped out.
• Templates can be combined.
• Combination occurs through package extension.
TemplateLibrary
Stamp
Out
Components
Merge
Realizing MDA With MappingsBusiness Model
maps toPlatform
Independent Model
Platform Independent
Modelmaps to
Platform Specific Model
Manageability achieved
through many
intermediate mapping
components
Mappings for Component Based MDA
TemplateLibrary
StampOut
Components
Merge
Source Language
Target Language
TemplateLibrary
TemplateLibrary
Mappings
Free
Theory2Theory1
System
Models are freely constructed.
Theories are expressed as constraints on different system aspects.
Theories are partial views of a system.
Theories are combined to produce the final system description.
Modelling Theories for MDA
Mapping Theories
Theories can be used to express relationships.
Freely construct a relation and then combine with theories over aspects of the domains.
AS SD
Mapping
Theory1 Theory2
System
Case Study
TankFullamount : Real
temp : Real
TankHeatingamount : Real
temp : Real
TankCoolingamount : Real
temp : Real
LoadChemical
Heat
Cool
Heat
UnloadChemical
Cool
Heat
Definition of a simple language for dynamic behaviour.
Definition of language given by a meta-model for a language unit.
Machines
Machine
-name : StringState
-label : StringTrans
-name : String-type : String
Field*
-tgt
-src
*
*
Calcs
Calc
-id : StringObj
-label : StringStep
-name : String-value : Object
Slot*
-tgt
-src
*
*
SyntaxDomain
SemanticDomain
Semantics
MachineMeaningMachine Calc
StateMeaning
Trans StepTransMeaning
State Obj
FieldMeaningField Slot
Machines Calcs
Labelled
-<name> : String
<Element>
ContainsElementname
ContainerContained
<Container> <Contained>
*
NameSpace NameSpaceNamedname
<NameSpace>
<Named>->forAll(c c' | c.<name> = c'.<name> implies c = c')
NameSpacename
NameSpaceNamed
Identify general properties. Express them as templates:
Stamp Out Language Definition
Machines
NameSpace
-type : String
Field
Trans
State
-src -tgt
MachineTranslabelMachine
Statename
StateFieldname
Pattern from template library
Renaming information
Package is result of merging stamped out packages
Capture System Properties as Theories
• Machine Language is currently ‘free’.
• Requires constraints on syntax and semantics.
• Example: the source and target of every transition must be a machine state.
: Machine trans : EmptySet
: Machine
T : Settrans
states
S : Set
s : State t : State
: Machine
T : Settrans
states
S : Set
s : State t : State
: Trans
tgt
src
this is OK
If this is OK
then this is OK
An Object Theory DiagramWellFormedMachine:Machine
: Machine
trans
: EmptySet
: Machine
T : Set(Trans)trans
states
S : Set(State)
s : State t : State
: Machine
T : Set(Trans)trans
states
S : Set(State)
s : State t : State
: Trans
tgt
src
Theories are a proposed extension of MML:
theory WellFormedMachine:Machine or obj :Machine trans = Set{} end implies obj :Machine trans = T; states = S->including(s)->including(t) end obj :Machine trans = T->including(obj :Trans src = s; tgt = t end); states = S->including(s)->including(t) end end endend
Theory Extension
FieldSemantics:Semantics
v : Object : ValueOf t : String
ValueMeaning
label = l
: Slot : FieldMeaning
v : Object
value
label = ltype = t
: Field
Theories can be defined as extensions of existing theories.
Theories can be used to define relationships between model elements.
Assume a theory ValueMeaning that defines ValueOf between values and types:
theory FieldSemantics:Semantics extends ValueMeaning implies obj :ValueOf value = v; type = t end obj :FieldMeaning slot = obj :Slot label = l; value = v end; field = obj :Field label = l; type = t end end endend
Define the following theories:
All theories conform to the Semantics.
Theories can specialiseexisting theories.
The complete MachineSpecis constructed as a combination of thetheories over the semantics.
ValueMeaning
FieldSemantics
StateSemantics
TransSemantics
WellFormedMachine
Semantics
MachineSpec
Theory Templates
ContainsTheory
x : <Cd> y : <Cr> : <Rc>
X : Set(<Cd>)
: <Rp> : <Pd> : <Pr>
Y : Set(<Cr>)
X : Set(<Cd>)
: <Rp>
: <Pd> : <Pr>
Y : Set(<Cr>)
x : <Cd>y : <Cr>
Rc, Cd, CrRp, Pd, Pr
A relationship Rp holds between two container types Pd and Pr if a relationship Rc holds between all of the contained elements (of types Cd and Cr respectively).
Example: The mapping from a machine to a Java program is composed of sub-mappings from states to Java variables and transitions to Java methods.
Refinement and Refactoring
• Theories and theory templates can be used to capture standard intra and inter language relations.
• Libraries of verified relations.• Example: containership is refined to Java
Vectors.• Example: inheritance is refactored to
become delegation.
Conclusion
• Language Engineering is key for MDA.
• Reusing language aspects.
• Abstract patterns of language properties.
• Relationships and mappings.
• Theories capture reusable, executable properties.