Object-Oriented Theories for Model Driven Architecture

24
Object-Oriented Theories for Model Driven Architecture Tony Clark, King’s College, UK. Andy Evans, University of York, UK. Robert France, Colorado University, USA.

description

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 - PowerPoint PPT Presentation

Transcript of Object-Oriented Theories for Model Driven Architecture

Page 1: 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.

Page 2: Object-Oriented Theories for Model Driven Architecture

Overview

• Requirements for MDA

• Language Engineering for MDA

• Technology for MDA:– Package Extension– Templates– Theories– Refinement and Refactoring

Page 3: Object-Oriented Theories for Model Driven Architecture

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

Page 4: Object-Oriented Theories for Model Driven Architecture

Language Engineering for MDALanguage

Unit

ConcreteSyntax

AbstractSyntax

SemanticDomain

Parse/Display Semantics

LanguageUnit

LanguageMapping

LanguageUnit

LanguageUnit

Page 5: Object-Oriented Theories for Model Driven Architecture

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

Page 6: Object-Oriented Theories for Model Driven Architecture

Realizing MDA With MappingsBusiness Model

maps toPlatform

Independent Model

Platform Independent

Modelmaps to

Platform Specific Model

Manageability achieved

through many

intermediate mapping

components

Page 7: Object-Oriented Theories for Model Driven Architecture

Mappings for Component Based MDA

TemplateLibrary

StampOut

Components

Merge

Source Language

Target Language

TemplateLibrary

TemplateLibrary

Mappings

Page 8: Object-Oriented Theories for Model Driven Architecture

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

Page 9: Object-Oriented Theories for Model Driven Architecture

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

Page 10: Object-Oriented Theories for Model Driven Architecture

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.

Page 11: Object-Oriented Theories for Model Driven Architecture

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

Page 12: Object-Oriented Theories for Model Driven Architecture

Semantics

MachineMeaningMachine Calc

StateMeaning

Trans StepTransMeaning

State Obj

FieldMeaningField Slot

Machines Calcs

Page 13: Object-Oriented Theories for Model Driven Architecture

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:

Page 14: Object-Oriented Theories for Model Driven Architecture

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

Page 15: Object-Oriented Theories for Model Driven Architecture

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.

Page 16: Object-Oriented Theories for Model Driven Architecture

: 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

Page 17: Object-Oriented Theories for Model Driven Architecture

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

Page 18: Object-Oriented Theories for Model Driven Architecture

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

Page 19: Object-Oriented Theories for Model Driven Architecture

Theory Extension

FieldSemantics:Semantics

v : Object : ValueOf t : String

ValueMeaning

label = l

: Slot : FieldMeaning

v : Object

value

label = ltype = t

: Field

Page 20: Object-Oriented Theories for Model Driven Architecture

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

Page 21: Object-Oriented Theories for Model Driven Architecture

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

Page 22: Object-Oriented Theories for Model Driven Architecture

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.

Page 23: Object-Oriented Theories for Model Driven Architecture

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.

Page 24: Object-Oriented Theories for Model Driven Architecture

Conclusion

• Language Engineering is key for MDA.

• Reusing language aspects.

• Abstract patterns of language properties.

• Relationships and mappings.

• Theories capture reusable, executable properties.