Introduction to architectures based on models, models and metamodels. model driven architecture

Post on 04-Jul-2015

345 views 0 download

description

Introduction to Model-Driven Engineering and Model-Driven Architecture

Transcript of Introduction to architectures based on models, models and metamodels. model driven architecture

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Software ArchitecturePart III

Class #1

Introduction to Architectures based on Models, Models and Metamodels. Model-Driven Architecture

Vicente García Díaz2014

University of Oviedo

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

3

Source: http://blog.drummondhouseplans.com/category/multi-family/

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

4

Source: http://www.flightglobal.com//

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Formula 1 car

(domain)Model

describes

What is a model? (I)

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

6

What is a model? (II)

1. Point of reference to imitate or reproduce2. Element, that, for its perfection must be

followed and reproduced3. Small representation of something4. It is a theoretical scheme, usually

mathematical, of a system or of a complex reality, as the economic development of a country, which is made to facilitate the understanding and the study of its behavior

Source: http://www.rae.es/rae.html

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• Of course…

7

Models in software development?

Model ProductDevelopment

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• Classical engineering is based on the use of models to produce a product after conducting a development

▫ Is not possible to fully automate the development

8

Typical development process

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• Peculiarity: software products can be designed and created without “going out" of the computer

• Informatics Information + Automatic

9

Software development process

Model ProductDevelopment

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Could we automate the software development process?

Model-Driven Engineering(MDE)

10

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• Growth of software complexity

• It is not being reused the technological and domain knowledge

• It is necessary to industrialize software development

• The term software crisis is still valid

11

Motivation

The major cause of the software crisis is that the machines have become several orders of magnitude more powerful! To put it quite bluntly: as long as there were no machines, programming was no problem at all; when we had a few weak computers, programming became a mild problem, and now we have gigantic computers, programming has become an equally gigantic problem [Dijkstra, 1972]

[Standish Group, 2004]

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• The level of abstraction of languages is growing▫ Binary

▫ Assembly

▫ Procedural

▫ Object oriented

• Towards the solution space of the problem

• In the 80s CASE tools emerge▫ They did not have much success

12

Brief History (I)

+ number of errors in the development

+ level of abstraction

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

13

Brief History (II)

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• Reduce the complexity of current platforms

• Express the concepts of different domains in a more approximate way

14

Goals (I)

Domain concepts

Domain concepts

Concepts of the technology used

Mental work of developers

Concepts of the technology used

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• Abstract the specification of systems from the implementation in the target platform

• Improve portability, interoperability and reusability

• Optimize productivity

15

Goals (II)

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• To create software models

• Such models define the concepts of a particular domain

• Existing technologies encompassed in MDE allowed to work with the models as if they were programming languages of high-level abstraction

▫ Usually domain-specific languages

16

For what is mainly used MDE?

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Mobile applications

Source: http://www.metacase.com/support/45/manuals/S60%20Phone%20Example.pdf

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Insurance Products

Source: [Kelly and Tolvanen, 2008]

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

IP telephony

Source: [Kelly and Tolvanen, 2008]

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Digital watches

Source: [Kelly and Tolvanen, 2008]

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Home automation

Source: [Kelly and Tolvanen, 2008]

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Food traceability systems

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

GADE4ALL (I)

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

GADE4ALL (II)

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Others

Fuente: http://www.pleus.net/articles/boodsl/boodsl.htmhttp://sandervanderburg.blogspot.com.es/2011/05/deployment-abstractions-for-webdsl.html

http://mpov.timmorgan.org/cascadingrubies-ruby-dsl-for-generating-css/

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• Cascading relationship between models and metamodels

28

The metamodel

Elements of the real world

(domain)

Model Metamodeldescribedescribe

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

29

Conceptual space

Domain Metamodel

Meta-metamodel

Abstractsyntax

Semantics

Concrete syntax

Domain-specific

language

Formal model

Describe concepts of

<<instanceof>>

<<instanceof>>

Based on

Respects

Sub-domains

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• They were defined in the 60's by Carl Adam Petri

• They are a specialization of automata theory which allows to express concurrent events

• They have places, transitions and arcs

• Application areas: data analysis, software design, reliability, workflows ...

31

The domain of Petri Nets

P1

P2

P1P3 P5

T1

T2

15

4

17

3 4 6P4

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

32

A metamodel for the domain

+Name : string

Node

+weight : int

Arc

Place Transition

PetriNet

10..*

1

0..*

P1

P2

P1P3 P5

T1

T2

15

4

17

3 4 6

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

33

A meta-meta model for the domain

Model Element

Generalizable Element

Association ClassAttribute

Typed Element+Name : string

Node

+weight : int

Arc

Place Transition

PetriNet

10..*

1

0..*

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

34

Mapping between concrete and

abstract syntaxes

+Name : string

Node

+weight : int

Arc

Place Transition

PetriNet

1 0..*

1

0..*

P1 P2

T1

15 17

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• A metamodel defines the elements of a modeling language, the relationships among them and constraints

CompositeState

Event

Transition

0..n

0..1

0..n

0..1+trigger

State

0..n

0..n

0..n

0..n

0..n0..1 0..n0..1

StateMachine

0..n

0..1

0..n

+transitions

0..1

0..1

1

0..1

1

+top

Metamodel (abstract syntax)

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Concrete syntax (graphical)

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

State machine: an example of a state machineState: state1State: state2State: state3Transition: state1 – state2Transition: state1 – state3Transition: state2 – state3

Concrete syntax (textual)

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Metamodel (abstract syntax)

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

table Country do

field name, varchar(100),primary_key

field area, integer

end

table Person do

field id, autoinc, primary_key

field name, varchar(200)

field id_country, varchar(100), foreign_key(:Country)

end

Concrete syntax (textual)

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• Key in model-driven engineering

• It is imperative to:1. Build domain-specific languages

2. Validate models

3. Transform models

4. Generate artifacts (code, documentation, etc.)

5. Integration of tools

40

Benefits of the use of a metamodel

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• Defined by the Object Management Group OMG, approach whereby the system design is geared towards models

• OMG Object Management Group 1989

▫ International consortium of the software industry

▫ Composed of many organizations, IBM, Eclipse Foundation, W3C, Microsoft, HP, etc.

▫ Definition of standards

• http://www.omg.org/mda

42

Introduction to MDA

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• Computation Independent Model(CIM)

• Platform Independent Model (PIM)

• Platform Specific Model (PSM)

• Implementation Specific Model (ISM)

43

Points of view

CIM

PIM

PSM 1 PSM n

ISM 1 ISM n

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

PIM

PSMJ2EE

ISMJava

Transformation

Transformation

Definition of automatictransformation 1

Definition of automatictransformation 2

Vertical transformations

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

45

Four-layer architecture

MOF

UML SysML

UML models SysML models

System

Meta-metamodel (M3)

Metamodel (M2)

Model (M1)

Reality (M0)

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• UML (Unified Model Language)

• MOF (Meta Object Facility)

• XMI (XML Metadata Interchange)

• OCL (Object Constraint Language)

• QVT (Query View Transformation)

• There are others…

Standards of the OMG

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

• Ecore

ECORE META-METAMODEL

Meta-Object Facility (MOF) ECORE

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Software ArchitectureS

ch

oo

l o

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

y o

f O

vie

do

Introduction to Architectures based on

Models, Models and Metamodels.

Model-Driven Architecture

Thank you