Language, Models and Megamodels Tutorial on...

24
Language, Models and Megamodels Tutorial on Megamodelling Anya Helene Bagge Bergen Language Design Laboratory University of Bergen SATToSE’14 2014-07-10 Bagge (UiB / BLDL) Megamodelling 2014-07-10 1 / 18

Transcript of Language, Models and Megamodels Tutorial on...

Page 1: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

Language, Models andMegamodelsTutorial onMegamodelling

Anya Helene Bagge

Bergen Language Design LaboratoryUniversity of Bergen

SATToSE’142014-07-10

Bagge (UiB / BLDL) Megamodelling 2014-07-10 1 / 18

Page 2: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

Learning Outcomes

What is a model? ...a metamodel? ...a megamodel?Why would would you need one?Relations between modelsKinds of megamodelsMega patternsPractical megamodelling

I’m a language engineer, so we’ll start from a language perspective.

Bagge (UiB / BLDL) Megamodelling 2014-07-10 2 / 18

Page 3: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

So... What’s a Language?

A languageis a form of communicationhas structurecarries meaningis/creates abstraction

→ →

→→ → ∗←

Bagge (UiB / BLDL) Megamodelling 2014-07-10 3 / 18

Page 4: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

Languages

Kinds:Natural

Artificial

Formal

Software language: Artificiallanguage used in softwaredevelopment

Programming, Modelling,Data representation,Ontologies, APIs, ...

Forms:

Written Spoken Diagrams

Purpose:

General-PurposeCan define arbitraryabstractions

Domain-specific

Bagge (UiB / BLDL) Megamodelling 2014-07-10 4 / 18

Page 5: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

What’s a model?

A model is a simplification of a system build with an intended goal in mind.The model should be able to answer questions in place of the actual

system∗

Typically, a model represents a systemSystem may be abstract or realMay also be used in the sense of atype/class, example, instance, moldDescriptive or prescriptive

* [Bézivin, Gerbé, Towards a Precise Definition of the OMG/MDA Framework]

Bagge (UiB / BLDL) Megamodelling 2014-07-10 5 / 18

Page 6: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

...aaand a metamodel?

A metamodel is model of a modelling language

Modelling Language

Metamodel Model

←writtenIn

←conformsTo

←models

Bagge (UiB / BLDL) Megamodelling 2014-07-10 6 / 18

Page 7: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

’SupWithMegamodels?

A megamodel is model of a system of models

Bagge (UiB / BLDL) Megamodelling 2014-07-10 7 / 18

Page 8: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

A Totally Unrelated Example: ClimateModelling.

.Bagge (UiB / BLDL) Megamodelling 2014-07-10 8 / 18

Page 9: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

A Totally Unrelated Example: ClimateModelling.

.

←reprO

f

Bagge (UiB / BLDL) Megamodelling 2014-07-10 8 / 18

Page 10: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

A Totally Unrelated Example: ClimateModelling.

.

←reprO

f

Bagge (UiB / BLDL) Megamodelling 2014-07-10 8 / 18

Page 11: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

A Totally Unrelated Example: ClimateModelling.

.

←reprO

f

← impacts →

Bagge (UiB / BLDL) Megamodelling 2014-07-10 8 / 18

Page 12: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

A Totally Unrelated Example: ClimateModelling.

.

←reprO

f

←reprO

f

← impacts →

Bagge (UiB / BLDL) Megamodelling 2014-07-10 8 / 18

Page 13: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

A Totally Unrelated Example: ClimateModelling.

.

?

←reprO

f

←reprO

f

← impacts →

impac

ts?→

impac

ts?→

Bagge (UiB / BLDL) Megamodelling 2014-07-10 8 / 18

Page 14: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

WhyWould You Need aMegamodel?

To understand your system:Models have implicit relations andassumptions:

What technologies are in theenvironment?How does this model relate to othermodels? (e.g. models may showdifferent views of same system)

Systems of models may very complexNeed a model to understand them!

Supporting MDE with modelmanagementDefine software architecture

Things to model:LanguagesTechnologiesProgramsTransformationsRelations...

Relationships:ConformanceTransformationCompositionRepresentation...

Bagge (UiB / BLDL) Megamodelling 2014-07-10 9 / 18

Page 15: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

Megamodel Relations

Ad hoc megamodelling:Draw a diagram with modelsAdd relations between themRelations are in natural language

Focus is on understanding andcommunicating.

Jean-Marie’s relations:µ: representationOfε: elementOfδ: decomposedInχ: conformsTo

E.g.: Program is ElementOf Language,Grammar is RepresentationOf Language,Program ConformsTo Grammar,System is DecomposedIn Component

Bagge (UiB / BLDL) Megamodelling 2014-07-10 10 / 18

Page 16: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

Megamodel Relations

Relations in MegaL:

[Favre, Lämmel, and Varanovich, Modeling the Linguistic Architecture of SoftwareProducts]

Bagge (UiB / BLDL) Megamodelling 2014-07-10 11 / 18

Page 17: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

Megamodel Relations

Relations in MegaL:

:Language subsetOf :Language

:Artifact elementOf :Language

:Language domainOf :Function

:Function hasRange :Language

:FunctionApplication elementOf :Function

:Artifact inputOf :FunctionApplication

:FunctionApplication hasOutput :Artifact

:Artifact conformsTo :Artifact

:Artifact partOf :Artifact

:Artifact correspondsTo :Artifact

:Artifact dependsOn :Artifact

:Artifact dependsOn :Language

:Artifact realizationOf :Function

:Artifact definitionOf :Language

:Program partOf :Technology

:Library partOf :Technology

[Favre, Lämmel, and Varanovich, Modeling the Linguistic Architecture of SoftwareProducts]

Bagge (UiB / BLDL) Megamodelling 2014-07-10 11 / 18

Page 18: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

Megamodel Patterns

Example:Specification/Language/Program or Metamodel/Language/Model

MM L

M...

reprOf →

elem

entO

f→

reprOf →

MM L

M...

←conformsTo

reprOf →

[Favre, Megamodelling and etymology. A story of words: from MED to MDE viaMODEL in five millenniums]

Bagge (UiB / BLDL) Megamodelling 2014-07-10 12 / 18

Page 19: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

Practical Megamodelling: Modelling Language Artifacts

Str

Tkl

Tok

Ptr

Cst

Ast

text

editing

structuralediting

refactoring

code

transformation

Text

Layout

Layoutless

Abstract

Flat Structured

tokenizeconcat

strip

format

parse

unparse

parse

unparse

strip

format

implod

e explode

[Zaytsev & Bagge: Parsing in a Broad Sense]Bagge (UiB / BLDL) Megamodelling 2014-07-10 13 / 18

Page 20: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

Practical Megamodelling: Modelling Language Artifacts

Str

Tkl

Tok

Ptr

Cst

Ast

Text

Layout

Layoutless

Abstract

Flat Structured

←reprOf

←reprOf

← structOf

← structOf

←reprOf

←reprOf

[Zaytsev & Bagge: Parsing in a Broad Sense]Bagge (UiB / BLDL) Megamodelling 2014-07-10 14 / 18

Page 21: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

MegaL

[Favre, Lämmel, and Varanovich, Modeling the Linguistic Architecture of SoftwareProducts]

Bagge (UiB / BLDL) Megamodelling 2014-07-10 15 / 18

Page 22: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

Another Example: Astronomical Simulation Software

[Favre, Megamodelling and etymology. A story of words: from MED to MDE viaMODEL in five millenniums]

Bagge (UiB / BLDL) Megamodelling 2014-07-10 16 / 18

Page 23: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

Summary

Language is structured and meaningful communicationModels abstract over and represent systemsMetamodels are models of (modelling) languagesMegamodels are models of systems of models

Aimed at understanding (for humans)Makes relationships explicitIdentifies roles – and missing models

Bagge (UiB / BLDL) Megamodelling 2014-07-10 17 / 18

Page 24: Language, Models and Megamodels Tutorial on Megamodellinggrammarware.github.io/sattose/slides/Bagge.pdf · Language,ModelsandMegamodels TutorialonMegamodelling AnyaHeleneBagge Bergen

Image credits:

3/Vase: Guillaume Blanchard (CC-BY-SA-1.0)

3/Sun: Alan Murray Walsh / www.geograph.org.uk (CC-BY-SA-2.0)

3/Duck: J.M.Garg / Wikimedia (GNU-FDL)

3/Father and son: Onkelbo / Wikimedia (GNU-FDL)

3/Hatshepsut: Keith Schengili-Roberts / Wikimedia / Ägyptisches Museum Berlin (CC-BY-SA-3.0)

5/System model: Phil’s Astronomy Blog

6/Solar system model: Mrs. Studivan

8/Earth: NASA (public domain)

8/Climate model: NOAA (public domain)

8/People: James Cridland (CC-BY)

8/The Sims cover: EA

10/Jean-Marie Favre: Eelco Visser

Bagge (UiB / BLDL) Megamodelling 2014-07-10 18 / 18