(Domain-Specific) Modelling Language Engineering Hans Vangheluwe 5 - - PowerPoint PPT Presentation

domain specific modelling language engineering
SMART_READER_LITE
LIVE PREVIEW

(Domain-Specific) Modelling Language Engineering Hans Vangheluwe 5 - - PowerPoint PPT Presentation

(Domain-Specific) Modelling Language Engineering Hans Vangheluwe 5 September 2010, Lisboa, Portugal (Domain-Specific) Modelling Language Engineering Overview Domain-Specific (Visual) Modelling DS(V)M 1 What/Why of DS(V)M (and DS(V)Ls) ?


slide-1
SLIDE 1

(Domain-Specific) Modelling Language Engineering Hans Vangheluwe

5 September 2010, Lisboa, Portugal

slide-2
SLIDE 2

(Domain-Specific) Modelling Language Engineering

Overview

1

Domain-Specific (Visual) Modelling – DS(V)M

What/Why of DS(V)M (and DS(V)Ls) ?

2

Dissecting Modelling

3

Dissecting Modelling Languages

4

Building DS(V)M Tools Effectively

1

Specifying syntax of DS(V)Ls:

abstract (meta-modelling) concrete (textual–visual)

2

Specifying DS(V)L semantics: transformations

3

Modelling (and executing) transformations: (rule-based) transformation languages

2

slide-3
SLIDE 3

(Domain-Specific) Modelling Language Engineering

Domain-Specific Modelling Example NATO’s Sarajevo WWTP www.nato.int/sfor/cimic/env-pro/waterpla.htm

3

slide-4
SLIDE 4

(Domain-Specific) Modelling Language Engineering

DS(V)M Environment www.hemmis.com/products/west/

4

slide-5
SLIDE 5

(Domain-Specific) Modelling Language Engineering

Why DS(V)M ? (as opposed to General Purpose modelling)

5

slide-6
SLIDE 6

(Domain-Specific) Modelling Language Engineering

Why DS(V)M ? (as opposed to General Purpose modelling)

match the user’s mental model of the problem domain

5

slide-7
SLIDE 7

(Domain-Specific) Modelling Language Engineering

Why DS(V)M ? (as opposed to General Purpose modelling)

match the user’s mental model of the problem domain maximally constrain the user (to the problem at hand) ⇒ easier to learn ⇒ avoid errors

5

slide-8
SLIDE 8

(Domain-Specific) Modelling Language Engineering

Why DS(V)M ? (as opposed to General Purpose modelling)

match the user’s mental model of the problem domain maximally constrain the user (to the problem at hand) ⇒ easier to learn ⇒ avoid errors separate domain-expert’s work from analysis/transformation expert’s work

5

slide-9
SLIDE 9

(Domain-Specific) Modelling Language Engineering

Why DS(V)M ? (as opposed to General Purpose modelling)

match the user’s mental model of the problem domain maximally constrain the user (to the problem at hand) ⇒ easier to learn ⇒ avoid errors separate domain-expert’s work from analysis/transformation expert’s work

Anecdotal evidence of 5 to 10 times speedup

Steven Kelly and Juha-Pekka Tolvanen. Domain-Specific Modeling: Enabling Full Code Generation. Wiley, 2008. Laurent Safa. The practice of deploying DSM, report from a Japanese appliance maker trenches. In Proceedings of the 6th OOPSLA Workshop on Domain-Specific Modeling (DSM’06), pp. 185-196, 2006. 5

slide-10
SLIDE 10

(Domain-Specific) Modelling Language Engineering

DS(V)M Example in Software Domain smart phones, the application MetaEdit+ (www.metacase.com)

6

slide-11
SLIDE 11

(Domain-Specific) Modelling Language Engineering

DS(V)M Example: smart phones, the Domain-Specific model

7

slide-12
SLIDE 12

(Domain-Specific) Modelling Language Engineering

Model-Based Development: Modify the Model (e.g., based on feature model of product family)

model model’ app’ app transformation transformation small modification

8

slide-13
SLIDE 13

(Domain-Specific) Modelling Language Engineering

Model-Based Development: Modify the Model (e.g., based on feature model of product family)

model model’ app’ app transformation transformation small modification

small modification in model may lead to large change in app ∼ choice of formalism (e.g., Statecharts)

8

slide-14
SLIDE 14

(Domain-Specific) Modelling Language Engineering

Statecharts

9

slide-15
SLIDE 15

(Domain-Specific) Modelling Language Engineering

Model-Based Development: Modify the Transformation (e.g., target platform changes, or optimization)

model model app’ app transformation small modification transformation’

10

slide-16
SLIDE 16

(Domain-Specific) Modelling Language Engineering

Can be Multi-Step/Multi-Formalism

11

slide-17
SLIDE 17

(Domain-Specific) Modelling Language Engineering

Building DS(V)M Tools Effectively . . .

development cost of DS(V)M Tools may be prohibitive! ⇒ need Modelling Language Engineering

12

slide-18
SLIDE 18

(Domain-Specific) Modelling Language Engineering

Dissecting Modelling

13

slide-19
SLIDE 19

(Domain-Specific) Modelling Language Engineering

Model Features

14

slide-20
SLIDE 20

(Domain-Specific) Modelling Language Engineering

Token Models

15

slide-21
SLIDE 21

(Domain-Specific) Modelling Language Engineering

Rôles a Model may Play

16

slide-22
SLIDE 22

(Domain-Specific) Modelling Language Engineering

Ontological vs. Linguistic Instantiation

17

slide-23
SLIDE 23

(Domain-Specific) Modelling Language Engineering

Language Definition Stack

18

slide-24
SLIDE 24

(Domain-Specific) Modelling Language Engineering

Meta-models as Language Definitions

19

slide-25
SLIDE 25

(Domain-Specific) Modelling Language Engineering

Meta-hierarchy – OMG’s 4 Layer Architecture

20

slide-26
SLIDE 26

(Domain-Specific) Modelling Language Engineering

Dissecting a Modelling Language

21

slide-27
SLIDE 27

(Domain-Specific) Modelling Language Engineering

Deciding on terminology

22

slide-28
SLIDE 28

(Domain-Specific) Modelling Language Engineering

What’s in a name ? Language

23

slide-29
SLIDE 29

(Domain-Specific) Modelling Language Engineering

What’s in a name ? Formalism

24

slide-30
SLIDE 30

(Domain-Specific) Modelling Language Engineering

What’s in a name ? Base Formalism

25

slide-31
SLIDE 31

(Domain-Specific) Modelling Language Engineering

What’s in a name ? Concrete Language

26

slide-32
SLIDE 32

(Domain-Specific) Modelling Language Engineering

What’s in a name ? Concrete Formalism

27

slide-33
SLIDE 33

(Domain-Specific) Modelling Language Engineering

Modelling a Modelling Language/Formalism

28

slide-34
SLIDE 34

(Domain-Specific) Modelling Language Engineering

Sets of Models

29

slide-35
SLIDE 35

(Domain-Specific) Modelling Language Engineering

From now on: use AToM3

30

slide-36
SLIDE 36

(Domain-Specific) Modelling Language Engineering

A model in the PacMan Formalism

Your score 31

slide-37
SLIDE 37

(Domain-Specific) Modelling Language Engineering

Modelling Abstract Syntax (meta-model)

Cardinalities:

  • To gridBottomV3: 0 to N
  • From gridBottomV3: 0 to N
  • From pacLinkV3: 0 to N
  • From foodLinkV3: 0 to N
  • From scoreLinkV3: 0 to N
  • To gridLeftV3: 0 to N
  • From gridLeftV3: 0 to N
  • To gridRightV3: 0 to N
  • From gridRightV3: 0 to N
  • To gridTopV3: 0 to N
  • From gridTopV3: 0 to N
  • From ghostLinkV3: 0 to N

gridNodeCenter Cardinalities:

  • To pacLinkV3: 0 to N

pacmanV3 Cardinalities:

  • To foodLinkV3: 0 to N

pacFoodV3 Attributes:

  • score :: Integer

Actions: > create Cardinalities:

  • To scoreLinkV3: 0 to N

ScoreBoard Cardinalities:

  • To ghostLinkV3: 0 to N

ghostV3 gridLeftV3 Cardinalities:

  • To gridNodeCenter: 0 to 1
  • From gridNodeCenter: 0 to 1

gridTopV3 Cardinalities:

  • To gridNodeCenter: 0 to 1
  • From gridNodeCenter: 0 to 1

gridBottomV3 Cardinalities:

  • To gridNodeCenter: 0 to 1
  • From gridNodeCenter: 0 to 1

gridRightV3 Cardinalities:

  • To gridNodeCenter: 0 to 1
  • From gridNodeCenter: 0 to 1

ghostLinkV3 Cardinalities:

  • To gridNodeCenter: 0 to N
  • From ghostV3: 0 to N

scoreLinkV3 Cardinalities:

  • To gridNodeCenter: 0 to N
  • From ScoreBoard: 0 to N

pacLinkV3 Cardinalities:

  • To gridNodeCenter: 0 to N
  • From pacmanV3: 0 to N

foodLinkV3 Cardinalities:

  • To gridNodeCenter: 0 to N
  • From pacFoodV3: 0 to N

32

slide-38
SLIDE 38

(Domain-Specific) Modelling Language Engineering

Modelling the Scoreboard Entity

33

slide-39
SLIDE 39

(Domain-Specific) Modelling Language Engineering

Synthesis of Code for Syntax-Directed Editing

class ScoreBoard(ASGNode, ATOM3Type): # Abstract Syntax only def __init__(self, parent = None): ASGNode.__init__(self) ATOM3Type.__init__(self) self.graphClass_ = graph_ScoreBoard self.isGraphObjectVisual = True self.parent = parent self.score=ATOM3Integer(0) self.generatedAttributes = {’score’: (’ATOM3Integer’ ) } self.directEditing = [1] def clone(self): cloneObject = ScoreBoard( self.parent ) for atr in self.realOrder: cloneObject.setAttrValue(atr,self.getAttrValue(atr).clone()) ASGNode.cloneActions(self, cloneObject) return cloneObject

34

slide-40
SLIDE 40

(Domain-Specific) Modelling Language Engineering

Meta-modelling: model-instance morphism

name type=String init.value= tokens type=Integer init.value=0 PNPlace name type=String init.value= PNTransition mapping mapping mapping mapping place1 place2 transition level M2: model a model of the Petri Net formalism, an INSTANCE of the Entity Relationship formalism level M1: data a Petri Net, an INSTANCE of the Petri Net formalism tran2pl pl2tran mapping mapping

35

slide-41
SLIDE 41

(Domain-Specific) Modelling Language Engineering

Meta-meta-. . . : Meta-circularity

36

slide-42
SLIDE 42

(Domain-Specific) Modelling Language Engineering

Sets of Models: Modelling Concrete Syntax

37

slide-43
SLIDE 43

(Domain-Specific) Modelling Language Engineering

Modelling Ghost Class Instances Concrete Visual Syntax

38

slide-44
SLIDE 44

(Domain-Specific) Modelling Language Engineering

Modelling PacFoodLink Association Concrete Visual Syntax

# Get n1, n2 end-points of the link n1 = self.in_connections_[0] n2 = self.out_connections_[0] # g1 and g2 are the graphEntity visual objects g0 = self.graphObject_ # the link g1 = n1.graphObject_ # first end-point g2 = n2.graphObject_ # second end-poing # Get the high level constraint helper and solver from Qoca.atom3constraints.OffsetConstraints import OffsetConstraints

  • c = OffsetConstraints(self.parent.qocaSolver)

# The constraints

  • c.CenterX((g1, g2, g0))
  • c.CenterY((g1, g2, g0))
  • c.resolve()

39

slide-45
SLIDE 45

(Domain-Specific) Modelling Language Engineering

Synthesize + Customize Buttons model

New Edit New Help New gridNodeCenter New pacmanV3 New pacFoodV3 New ScoreBoard New ghostV3

Note: create vs. execute

40

slide-46
SLIDE 46

(Domain-Specific) Modelling Language Engineering

Default generated Buttons code for ghostV3

# This method has as parameters: #

  • wherex: X Pos. in window coordinates where user clicked.

#

  • wherey: Y Pos. in window coordinates where user clicked.

newPlace = self.createNewghostV3 (self, wherex, wherey)\n’))

41

slide-47
SLIDE 47

(Domain-Specific) Modelling Language Engineering

Can now build valid PacMan models ?

Your score

42

slide-48
SLIDE 48

(Domain-Specific) Modelling Language Engineering

Model the GUI’s Reactive Behaviour ! in the most appropriate formalism . . . Statecharts

43

slide-49
SLIDE 49

(Domain-Specific) Modelling Language Engineering

The GUI’s reactive behaviour in action

challenge: what is the optimal formalism to specify GUI reactive behaviour ?

44

slide-50
SLIDE 50

(Domain-Specific) Modelling Language Engineering

Concrete Visual Syntax

  • G. Costagliola, A. Delucia, S. Orefice and G. Polese.

A Classification Framework to Support the Design of Visual Languages. Journal of Visual Languages and Computing, Volume 13, Issue 6, December 2002, pages 573-600.

45

slide-51
SLIDE 51

(Domain-Specific) Modelling Language Engineering

Plex

46

slide-52
SLIDE 52

(Domain-Specific) Modelling Language Engineering

Graph

47

slide-53
SLIDE 53

(Domain-Specific) Modelling Language Engineering

Connection Types

48

slide-54
SLIDE 54

(Domain-Specific) Modelling Language Engineering

Iconic

49

slide-55
SLIDE 55

(Domain-Specific) Modelling Language Engineering

Box

50

slide-56
SLIDE 56

(Domain-Specific) Modelling Language Engineering

Visual Language Classification

51

slide-57
SLIDE 57

(Domain-Specific) Modelling Language Engineering

Hybrid Languages

52