Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail :...

23
Model-Driven Software Engineering Franck Fleurey e-mail : [email protected] http://www.fleurey.com/franck INF 5120

Transcript of Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail :...

Page 1: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

Model-Driven Software Engineering

Franck Fleureye-mail : [email protected]

http://www.fleurey.com/franck

INF 5120

Page 2: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 2

From the object as the only one concept– As e.g. in Smalltalk

To a multitude of concepts

Once upon a time…software development looked simple

Design patterns

Collaborations

Required port Provided Port

<<Component>>Decoder

DecoderIReceiverI

DaDataI

ComponentsCOM+DCOM

CORBAIIOP

MicrosoftC# & .Net

XMLSOAP

Sun’s Java &

EJB

HTTPHTML

+ until the next ultimate middleware platform (~2005)

ProprietaryMiddleware(eg. automotive)

It's difficult -- in fact, next to impossible – for a large enterprise to standardize on a single middleware platform. (R. Soley)

Middleware (middle war)

Aspects

Page 3: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 33

Automotive industry: Volkswagen

Page 4: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

4

Nokia

1,1 billion operational mobile phones– 100 millions de plus

par an

Thousands of hardware/software version

Time-to-market ~ 3 month

Page 5: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 5

Why modeling: master complexity

Modeling, in the broadest sense, is the cost-effective use of something in place of something else for some cognitive purpose. It allows us to use something that is simpler, saferor cheaper than reality instead of reality for some purpose.

A model represents reality for the given purpose; the model is an abstraction of reality in the sense that it cannot represent all aspects of reality. This allows us to deal with the world in a simplified manner, avoiding the complexity, danger and irreversibility of reality.

Jeff Rothenberg.

Page 6: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 6

Modeling in Science & Engineering A Model is a simplified representation of an aspectof the World for a specific purpose

M0(the world)

M1(modelingspace) Is represented by

Specificity of Engineering:Model something not yet existing (in order to build it)

Specificity of Engineering:Model something not yet existing (in order to build it)

+Applicant()+ApplicantInfo()+MakeApplication()

-companyName : CString-experience : CString-reference1 : CString-reference2 : CString-reference3 : CString

Applicant

+Person()+PersonInfo()

-personID : unsigned long-surname : CString-givenName : CString-middleInitial : char-streetAddress : CString-postCode : CString-countryname : CString-eMailAddress : CString

Person

-is taught by

1

-teaches

0..*+CourseSession()+CourseSessionInfo()

-courseSessionID : unsigned long-courseDate : unsigned long-courseID : unsigned long-courseLocation : CString

CourseSession

+AppStatus()+AppStatusInfo()

-statusCode : char-statusName : CString

AppStatus

+CourseRegistration()+CourseRegistrationInfo()

-registrationDate : unsigned long-completionFlag : bool-confirmedDate : unsigned long

CourseRegistration

+Test()+TestInfo()

-testScore : unsigned longTest

+Application()+ApplicationInfo()

-productNr : unsigned long-certificationLevel : unsigned long-applicationDate : unsigned long

Application

+PermittedStatusChange()+StatusChangeInfo()

-fromStatus : char-toStatus : char

PermittedStatusChange

+ExamSession()+ExamSessionInfo()

-examSession : unsigned long-examlocation : CString-examDate : unsigned long

ExamSession

-gives0..*

-is achieved1

-is made by

1

-makes

0..*

-allows change in

0..*

-has a

1..*

-is taken by1

-takes0..*

-is made by a1

-made a1..*

-is in1

-is filled by0..*

-uses

1

-is used in

0..*

-applies to a0..*

-is for a1

+Exam()+ExamInfo()

-examID : unsigned long-certificationLevel : unsigned long

Exam

+Employee()+GetCurrentAge()+EmployeeInfo()

-jobType : CString-roomNr : unsigned long-department : CString-division : CString-jobTitle : CString-manager : unsigned long-headsDept : CString-headsDivision : CString-mobileNr : CString-birthDate : unsigned long

Employee

+registrationform()

RegistrationForm

-uses**

ApplicantApplicantList PersonList

findApplicant()

ApplicationRegForm

Applicant()

findPerson()

addPerson()

addApplication()

Application()

MakeApplication()

ApplicationList

Page 7: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 7

Model and Reality in Software Sun Tse: Do not take the map for the reality Magritte

Software Models: from contemplative to productive

Page 8: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 8

Modeling and Weaving

DesignModel

Use CaseModel

SecurityModel

QoSModel Business

Model

ObjectModel

TestModel

UIModel

PlatformModel

CodeModel

tester

Challenges:-Product Families-Reuse of Weaving Process

-Automatic Weaving

Challenges:-Product Families-Reuse of Weaving Process

-Automatic Weaving

Page 9: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 9

The UML The Unified Modelling Language Built be aggregating many appraoches Standardized (OMG) One (main) purpose: Build Software

No standardized method to use the UML Industrial tool support

Page 10: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

10

Origins of the UML

OOA(P. Coad)

OMT(J. Rumbaugh et al.)

Data-FlowSADT/SA-SD(De Marco)

OOA - OODLE(Schlaer & Mellor)

Statecharts(HAREL)

FUSION(HP-Labs)

UML(Rumbaugh, Booch, Jacobson)

Use-Case(I.Jacobson)

Entity-RelationMerise(Chen)

OOA-OOD(G.Booch)

CLASSE-RELATION(P. Desfray)

CRC(R. Wirf-Brooks)

JSD(M. Jackson)

Page 11: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

11

UML History

Other methods Booch’91 OMT-1 OOSE Partners

Booch’93 OMT-2

Unified Method 0.8

UML 0.9

UML 1.0

UML 1.1

UML 1.2

UML 1.x

UML 2.0

1999-2002

Juin 1998

Nov 1997Sept 1997

Jan 1997

Jun 1996

Oct 1995

Page 12: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

12

Structural Modeling Diagrams

Structure diagrams define the static architecture of a model. They are used to model the 'things' that make up a model - the classes, objects, interfaces and physical components. In addition they are used to model the relationships and dependencies between elements.

– Package diagrams are used to divide the model into logical containers or 'packages' and describe the interactions between them at a high level

– Class or Structural diagrams define the basic building blocks of a model: the types, classes and general materials that are used to construct a full model

– Object diagrams show how instances of structural elements are related and used at run-time.

– Composite Structure diagrams provide a means of layering an element's structure and focusing on inner detail, construction and relationships

– Component diagrams are used to model higher level or more complex structures, usually built up from one or more classes, and providing a well defined interface

– Deployment diagrams show the physical disposition of significant artefacts within a real-world setting.

Page 13: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

13

Behavioral Modeling Diagrams

Behavior diagrams capture the varieties of interaction and instantaneous state within a model as it 'executes' over time.

– Use Case diagrams are used to model user/system interactions. They define behavior, requirements and constraints in the form of scripts or scenarios

– Activity diagrams have a wide number of uses, from defining basic program flow, to capturing the decision points and actions within any generalized process

– State Machine diagrams are essential to understanding the instant to intant condition or "run state" of a model when it executes

– Communication diagrams show the network and sequence of messages or communications between objects at run-time during a collaboration instance

– Sequence diagrams are closely related to Communication diagrams and show the sequence of messages passed between objects using a vertical timeline

– Timing diagrams fuse Sequence and State diagrams to provide a view of an object's state over time and messages which modify that state

– Interaction Overview diagrams fuse Activity and Sequence diagrams to provide allow interaction fragments to be easily combined with decision points and flows

Page 14: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

Domain specific modellinglanguages

Specific to a domain More focussed purpose Usable by the domain experts More productive than general purpose

– If properly designed and tooled! UML profiles vs. DSL

14

Page 15: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 15

Assigning Meaning to Models If a model is no longer just

– fancy pictures to decorate your room– a graphical syntax for C++/Java/C#/Eiffel...

Then tools must be able to manipulate models– Let’s make a model of what a model is!– => meta-modeling

» & meta-meta-modeling..» Use Meta-Object

Facility (MOF) to avoidinfinite Meta-recursion

ConstraintNamespace

Package

GeneralizableElement

0..*

0..*+supertype

{ordered}0..*

+subtype

0..*Generalizes

Classifier

Class AssociationDataType

Feature

BehavioralFeature StructuralFeature

Operation

AssociationEnd

Reference

0..*

1

+referent0..*

+referencedEnd1

RefersTo

MofAttribute

ModelElement

0..*0..1

+containedElement

{ordered}

0..*+container

0..1

Contains

0..*

1..*

0..*

+constrainedElement

1..*Constrains

Page 16: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 16

UML2 meta-model

(part., © OMG)

Page 17: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 17

Generalizations

© OMG

NB: Tell you nothing about:•generalization being acyclic, •or semantics of dynamic binding

*

Page 18: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 18

The 4 layers in practice

© OMG

Page 19: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 19

Comparing Abstract Syntax Systems

Pascal LanguageGrammar

A specificPascal Program

A specificexecution

of a Pascal program

EBNF MOF

The UMLmeta-Model

A Specificphenomenon

corresponding toa UML Model

A SpecificUML Model

Technology #2(MOF + OCL)

M3

M2

M1

Technology #1(formal grammars

attribute grammars,etc.)

A XMLdocument

A XML DTDOr Schema

A XMLdocument

A XML DTDor Schema

Technology #3(XML Meta-Language)

KIFTheories

Upper LevelOntologies

Technology #4(Ontology engineering)

[XMI=MOF+XML+OCL]

+DescriptionLogics

+ConceptualGraphs+etc.

+ Xlink, Xpath, XSLT+ RDF, OIL, DAML+ etc.

(From J. Bézivin)

Page 20: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 20

MDA: the OMG vision"OMG is in the ideal position to provide the model-based standards that are necessary to extend integration beyond the middleware approach… Now is the time to put this plan into effect. Now is the time for the Model Driven Architecture."

Richard Soley & OMG staff, MDA Whitepaper Draft 3.2

November 27, 2000

Page 21: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 21

Mappings to multiple and evolving platforms

COM+DCOM

CORBA C#.Net XML

SOAP

JavaEJB HTTP

HTML

MOF & UML as the core

Organization assets expressed as models

Model transformations to map to technology specific platforms

Platform neutral models basedon UML & MOF

Page 22: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 22

The core idea of MDA:PIMs & PSMs

MDA models– PIM: Platform Independent Model

» Business Model of a system abstracting away the deployment details of a system

» Example: the UML model of the GPS system– PSM: Platform Specific Model

» Operational model including platform specific aspects» Example: the UML model of the GPS system on .NET

Possibly expressed with a UML profile (.NET profile for UML)

– Not so clear about platform models» Reusable model at various levels of abstraction

CCM, C#, EJB, EDOC, …

Page 23: Model-Driven Software Engineering · Model-Driven Software Engineering Franck Fleurey e-mail : Franck.Fleurey@sintef.no ... The UML The Unified ... (HP-Labs) UML (Rumbaugh, Booch,

INF5120 – 2011 – Franck Fleurey ([email protected]) 23

Model Driven Engineering : Summary

Modeling to master complexity– Multi-dimensional and aspect oriented by definition

Models: from contemplative to productive– Meta-modeling tools, meta-models used to define languages

Model Driven Engineering– Weaving aspects into a design model

» E.g. Platform Specificities

Model Driven Architecture (PIM / PSM): just a special case of Aspect Oriented Design

Related: Generative Prog, Software Factories