model-driven development and dsls - · pdf filemodel-driven development and dsls ......

101
11.08.2011 1 Model-Driven Development and DSLs in the context of embedded sytems Markus Voelter Independent/itemis [email protected] A little History Domain Specific Languages Examples Tools Benefits Architecture DSLs A more theoretical View Programming and Modeling The LWES Project Bonus: Best Practices

Upload: duongkiet

Post on 09-Mar-2018

235 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

1

Model-DrivenDevelopment and DSLs

in the context of embedded sytems

Markus VoelterIndependent/itemis

[email protected]

A little HistoryDomain Specific LanguagesExamplesToolsBenefitsArchitecture DSLsA more theoretical ViewProgramming and ModelingThe LWES ProjectBonus: Best Practices

Page 2: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

2

A little History

programming

close to the hardwarestarted

abstractionscomputing

chips

Page 3: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

3

abstractionscomputing

bits

C

abstractionscomputing

Page 4: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

4

Java

abstractionscomputing?

SQL

abstractionscomputing?

Page 5: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

5

Page 6: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

6

general purpose

domain specific

Page 7: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

7

effective++

specialized, limited

used by experts

together with otherspecialized tools

tailor made

Domain Specific Languages

Page 8: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

8

DSLA DSL is a focussed, processable

language for describing a specific

concern when building a system in a

specific domain. The abstractions and

notations used are natural/suitable for

the stakeholders who specify that

particular concern.

map

Page 9: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

9

DSL Program

GPL Program

(aka Model)

map

automated!

map

GenerationTransformationCompilation

Interpretation

Page 10: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

10

Analysing DomainsDefining Languages

Activities

Building EditorsTransforming ModelsBuilding Generators

Building Frameworks

Adapting/Selecting

… and using all of that to build apps

Page 11: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

11

internal

external

vs.

compiled

interpreted

vs.

Page 12: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

12

customization

configuration

vs.

graphical

textual

vs.

Page 13: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

13

Examples

Example 1:

Embedded Protocol Handler

Page 14: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

14

SOLU

TIO

NComponent Specification

SOLU

TIO

N

Message Format Definition

Page 15: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

15

tests

refines

SOLU

TIO

NTesting

TOO

LS

Eclipse ModelingEclipse Xtext

Page 16: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

16

Example 2:

Pension Fund SpecificationSO

LUTI

ON

Textual Documentation

Page 17: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

17

SOLU

TIO

NInsurance Mathematics

SOLU

TIO

N

Calculation Rules and Tests

Page 18: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

18

TOO

LS

Intentional Software‘s Domain Workbench

Example 3:

Radar Systems Engineering

Page 19: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

19

SOLU

TIO

NComponent Definition

SOLU

TIO

N

Component Behavior Specification

Page 20: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

20

SOLU

TIO

NResulting System Behaviour

SOLU

TIO

N

Analysis

Page 21: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

21

TOO

LS

Eclipse ModelingEclipse XtextWolfram MathematicaMathematica Workbench

Example 4:

Alarm System Menus

Page 22: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

22

SOLU

TIO

NMenu Structure

SOLU

TIO

N

Software Components

Page 23: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

23

TOO

LS

Eclipse ModelingEclipse Xtext

Example 5:

Requirements Tracability

Page 24: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

24

SOLU

TIO

NImported Requirements

SOLU

TIO

N

Program Code with Annotations (green)

Page 25: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

25

SOLU

TIO

NSelecting from the Requirements

Find Usages of Requirements

TOO

LS

JetBrains MPS

Page 26: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

26

Example 5:

OSGi-based SystemSO

LUTI

ON

Component Specification

Page 27: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

27

SOLU

TIO

NComponent Specification

SOLU

TIO

N

Component Specification

Page 28: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

28

TOO

LS

Eclipse ModelingEclipse Xtext

Example 6:

Math, Science and Java

Page 29: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

29

SOLU

TIO

NSO

LUTI

ON

Page 30: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

30

SOLU

TIO

NTO

OLS

JetBrains MPS

Page 31: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

31

Example 7:

FountainsC

ON

TEX

T

Page 32: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

32

SOLU

TIO

NHardware Structure

SOLU

TIO

N

Behaviour

Page 33: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

33

SOLU

TIO

NPlus:

In-IDE SimulatorUnit Test Support

TOO

LS

Eclipse ModelingEclipse Xtext

Page 34: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

34

More Examples8:

MiscellaneousD

OM

AIN

Hearing Aids

Page 35: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

35

DO

MA

INRefrigerators

SOLU

TIO

N

BPEL Designer

Page 36: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

36

SOLU

TIO

NBlock Diagrams

SOLU

TIO

N

PLC Programming

Page 37: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

37

SOLU

TIO

NState Charts

TOO

LS

Page 38: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

38

Tools

Tooling!Editor, Debugger, Testing, Groupware, Scalable, „All in Eclipse“

Page 39: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

39

Tools Tooling

Language Definition Tools

Editor FrameworksTransformation Languages

Code Generation Tools

abstract syntax, concrete syntax, constraints

Page 40: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

40

Current Version 2.0:improved performance

Xbase: expressions for reuse

Xtend2: „Better Java“, with support

for Xpand-like templates

Eclipse-based, Eclipse ProjectVery flexible, very popular!

Open Source (EPL)

Page 41: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

41

Open Source (Apache 2.0)Projectional EditorVery good at lang. CompositionCurrent Version 2.0:

Improved performance

Unified generate/compile/build

Debug MPS in MPS

Tables in the editor

(Diagrams planned for 2.1)

Commercial Tool.Projectional EditorVery flexible notationsVersion 1.8 is current

Page 42: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

42

Way More:SpoofaxRascaloomegaThe Whole Platform

see alsohttp://languageworkbenches.net

Benefits

Page 43: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

43

Automationfaster, deterministic

Increased Qualitywell defined structures allthrough the system

Page 44: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

44

Meaningful Validationmore semantics in the model

CaptureDomain Knowledge

formalized into languages and models

Page 45: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

45

Suitable Notationstextual, graphical, tabular

Technology Independencegenerate „technology glue code“

Page 46: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

46

Abstraction w/oRuntime Overhead

generator „optimizes away“

Implementation StrategyCapture

in the generators

Page 47: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

47

Everything is a modelincluding for example hardware (some) hardware

Architecture DSLs

Page 48: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

48

AirportManagement

System

MonitorsWebsite

Aircraft-Module

Data Center

Page 49: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

49

component DelayCalculator {}

component InfoScreen {}

component AircraftModule {}

component DelayCalculator {

provides IDelayCalculator

requires IInfoScreen

}

component InfoScreen {

provides IInfoScreen

}

component AircraftModule {

provides IAircraftModule

requires IDelayCalculator

}

interface IDelayCalculator {}

interface IInfoScreen {}

interface IAircraftModule {}

Page 50: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

50

component InfoScreen {

provides IInfoScreen

}

instance screen1: InfoScreen

instance screen2: InfoScreen

component DelayCalculator {

provides default: IDelayCalculator

requires screens[0..n]: IInfoScreen

}

component InfoScreen {

provides default: IInfoScreen

}

component AircraftModule {

provides default: IAircraftModule

requires calculator[1]: IDelayCalculator

}

Page 51: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

51

component DelayCalculator {

provides aircraft: IAircraftStatus

provides managementConsole:

IManagementConsole

requires screens[0..n]: IInfoScreen

}

component Manager {

requires backend[1]: IManagementConsole

}

component InfoScreen {

provides default: IInfoScreen

}

component AircraftModule {

requires calculator[1]: IAircraftStatus

}

component DelayCalculator {

requires screens[0..n]: IInfoScreen

}

component InfoScreen {

provides default: IInfoScreen

}

instance dc: DelayCalculator

instance screen1: InfoScreen

instance screen2: InfoScreen

connect dc.screens

to (screen1.default, screen2.default)

Page 52: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

52

namespace com.mycompany.production {

instance dc: DelayCalculator

// InfoScreen instances are created and

// started in other configurations

dynamic connect dc.screens every 60 query {

type = IInfoScreen

status = active

}

}

interface IAircraftStatus {

oneway message reportPosition

(aircraft: ID, pos: Position )

request-reply message reportProblem {

request (aircraft: ID, problem: Problem,

comment: String)

reply (repairProcedure: ID)

}

}

Page 53: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

53

struct FlightInfo {

from: Airport

to: Airport

scheduled: Time

expected: Time

}

replicated singleton flights {

flights: FlightInfo[]

}

component DelayCalculator {

publishes flights

}

component InfoScreen {

consumes flights

}

interface IAircraftStatus {

oneway message registerAircraft(aircraft: ID! )

oneway message unregisterAircraft(aircraft: ID! )

oneway message reportPosition(aircraft: ID!,

pos: Position! )

request-reply message reportProblem {

request (aircraft: ID!, problem: Problem!,

comment: String!)

reply (repairProcedure: !ID)

}

protocol initial = new {

state new {

registerAircraft => registered

}

state registered {

unregisterAircraft => new

reportPosition

reportProblem

}

}

}

Page 54: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

54

As youunderstandand develop

yourArchitecture…

Develop a language toexpress it!

Page 55: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

55

Language resemblesarchitectural concepts

We express theapplication(s) with

the language.

Page 56: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

56

Architecture

DSL

Clear Understandingfrom building the

language

Page 57: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

57

UnambigiousVocabulary

Concepts independentfrom Technology

Page 58: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

58

Programming Model canbe defined based on

Conceptual Arcitecture

Architecture „executable“(i.e. more than rules and docs)

Page 59: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

59

Since we alreadyhave a formal model….

Generate APIMaps Architectural Concepts to

Implementation language (non-trivial!)

Implementation Code

ProgrammingModel API

Runtime Infrastructure(Platform/Middleware)

Glue Code

Page 60: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

60

ImplementationImplementation only depends on

the generated programming model API

Implementation Code

ProgrammingModel API

Runtime Infrastructure(Platform/Middleware)

Glue Code

Programming ModelGenerated API + Usage Idioms

Completely Technology-Independent

Implementation Code

ProgrammingModel API

Runtime Infrastructure(Platform/Middleware)

Glue Code

Page 61: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

61

Runtime InfrastructureSelect based on fit wrt. to architectural

concepts and non-functional requirements

Implementation Code

ProgrammingModel API

Runtime Infrastructure(Platform/Middleware)

Glue Code

Glue CodeAka Technology Mapping CodeMaps API to selected platform

Implementation Code

ProgrammingModel API

Runtime Infrastructure(Platform/Middleware)

Glue Code

Page 62: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

62

Glue CodeContains Configuration Files for Platform

Might require „mix in models“

Implementation Code

ProgrammingModel API

Runtime Infrastructure(Platform/Middleware)

Glue Code

Several PlatformsDifferent Platforms, not Languages

Support for Scaling (non-functional req)

Implementation Code

ProgrammingModel API

Runtime Infrastructure(Platform/Middleware)

Glue Code

Platform 2

Glue Code 2

Testing!

Page 63: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

63

Formal ArchitectureDescription is not new:

ADLs, UML

But all of those useexisting, generic

languages!

Page 64: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

64

Thismisses

thepoint!

Trying to express your specificarchitecture with predefined

abstractions is not useful!

Page 65: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

65

You want to build a languageto capture your own

architectural abstractions asyour learn things.

Where arestandards

useful?

Page 66: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

66

People haveto learn

architecturalconcepts anyway.

Is UML with a profilestill a

standardlanguage?

Page 67: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

67

On whichmeta level do

I want tostandardize?M2 (UML), M3 (MOF)?

Isn‘t a DSLbased on MOFas „standard“

as a profilebased on

UML?

Page 68: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

68

UML Profiles instead?You‘ll think more aboutUML-ities than your ownconcepts

UML Profiles instead?Tool integration issues(repository, diff/merge, versioning)

Page 69: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

69

UML Profiles instead?Tools are often complex, heavyweight, bloated. Acceptance limited.

UML Generally Useless?No. UML can be used fordocumentation(sequence diagrams, eg)

Page 70: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

70

A more theoretical View

Do

mai

n S

pe

cifi

cLa

ngu

age

s A DSL is a focussed, processable

language for describing a specific

concern when building a system in a

specific domain. The abstractions and

notations used are natural/suitable for

the stakeholders who specify that

particular concern.

Page 71: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

71

What‘s the Problem here?Li

ngu

isti

cA

bst

ract

ion

What‘s the Problem here?

Lin

guis

tic

Ab

stra

ctio

n

Much better with new linguistic abstraction

No sophisticated analysis required to understand the semantics of a contructand treat it “correctly”.

Page 72: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

72

What‘s this? And what‘s the Problem?Li

ngu

isti

cA

bst

ract

ion

Much better!

Lin

guis

tic

Ab

stra

ctio

n

Page 73: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

73

Much better!Li

ngu

isti

cA

bst

ract

ion

Do

mai

ns

are

Hie

rarc

hic

al

Page 74: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

74

Cre

atin

gLi

ngu

isti

cA

bst

ract

ion

sD

om

ain

Sp

eci

fic

Lan

guag

es

A DSL is a language at D that provides

linguistic abstractions for common

patterns and idioms of a language at

D-1 when used within the domain D.

A good DSL does not require the use of

patterns and idioms to express

semantically interesting concepts in D.

Processing tools do not have to do

“semantic recovery” on D programs.

Page 75: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

75

Exte

nsi

on

vs.

Cas

cad

ing

Programming and

Modeling

Page 76: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

76

Modeling

… (Mostly) GraphicalNotations

… Abstract Syntax Storage

… Projecting Editors

… Different editableviews for model

Programming

… (Mostly) Textual Notations

… Concrete Syntax Storage

… (Fancy) ASCII Editors

… Read-Only Visualizations

Whythe difference?

Page 77: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

77

Programmingthe way we do

Modeling?

Modelingthe way we do

Programming?

Modeling Programming

Programming Modeling

====

Page 78: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

78

We don‘t want to

we want tomodel,

program!… at different levels of abstaction

… from different viewpoints

… integrated!

We don‘t want to

we want tomodel,

program!… with different degrees of

… with suitable notations

… with suitable expressiveness

domain-specificity

Page 79: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

79

We don‘t want to

we want tomodel,

program!

precise and tool processableAnd always:

Programming Languages

are not

enough.MODULAR

Page 80: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

80

Programming Languages

are not

enough.COMPOSABLE

Programming Languages

are not

enough.CONFIGURABLE

Page 81: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

81

Programming Languages

are not

enough.ADAPTABLE

Programming Language Syntax

is not

enough.FLEXIBLE

Page 82: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

82

L

ab

c

d

e

f

gh

i

j

k

m

n

o

with many first class concepts!

Big Language?

L

Small Language?

and poweful conceptswith a few, orthogonal

Page 83: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

83

my L

a b c

d e f

g h i

j k l

Modular Language

composable conceptswith many optional,

Like frameworksand libraries,

but with syntaxand IDE support

Modular Language

Page 84: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

84

Seve

ralC

on

cern

sin

a D

om

ain

Vie

wp

oin

ts

Page 85: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

85

Vie

wp

oin

ts

A: mixedB: separate Viewpoints

Lan

guga

eC

om

bin

atio

n

When DSL (for several concerns) are developed from scratch, as a group, then dependencies between the concerns can be materialized as dependencies between the languages and the language concepts

Page 86: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

86

Lan

guga

eEx

ten

sio

n

A language B extends another language A if B contains additional language concepts. This means that for programs written in B, all concepts from A are available, plus those defined in B.

Lan

guga

eR

eu

se

A language has been developed to be used in contexts not known at the time of development. No dependencies allowed! The reusable language has to be extended so it can reference concepts from languages in that context.

Page 87: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

87

Lan

guga

eEm

be

dd

ing

Composition is a special case ofreuse, where the reused language is syntactically embedded into languages from the context.

The LWES Project

Page 88: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

88

LWESLanguage Workbenches

for

http://mbeddr.com

Embedded Systems

LWESLanguage Workbenches

for

http://mbeddr.com

Embedded Systems

Incremental Extension of Cwith DSLs for Embedded Systems,integrated with Formal Methodsand support for PLE andRequirements Tracing

Page 89: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

89

LWESLanguage Workbenches

for

http://mbeddr.com

Embedded Systems

LWESLanguage Workbenches

for

http://mbeddr.com

Embedded Systems

Page 90: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

90

EXA

MP

LE C

ASE

SOLU

TIO

N

Page 91: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

91

SOLU

TIO

NSO

LUTI

ON

Page 92: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

92

TOO

LS

JetBrains MPS

mbeddr.com

Page 93: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

93

Bonus:

Best Practices

Limit Expressiveness

Page 94: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

94

Notation, Notation, Notation

Graphical vs. Textual

Page 95: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

95

Viewpoints

Teamwork Support

Page 96: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

96

Interpretation Generation

vs.

Rich Domain Specific Platform

Page 97: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

97

Checks Firstand Separate

Cascading

Page 98: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

98

Annotation Models

Don‘t forgetTesting

Page 99: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

99

Iterate!

Co-Evolve Language and Concepts

Page 100: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

100

Domain UsersProgramming?

CompatibleOrganization

Page 101: Model-Driven Development and DSLs - · PDF fileModel-Driven Development and DSLs ... Architecture DSLs ... Eclipse Xtext Example 6: Math, Science and Java. 11.08.2011 29 ON ON. 11.08.2011

11.08.2011

101

web email twitter

xinglinkedin

[email protected]

http://www.xing.com/profile/Markus_Voelterhttp://www.linkedin.com/pub/0/377/a31

.coordinates

THE END.