Fusing Modeling and Programming
Our Experiences with MPS
... into Language-Oriented Programming
Markus Völter
voelter@acm.org
www.voelter.de
@markusvoelter
Industry
Theory ≤ Pragmatics
While I value
and conceptual
purity...
I value
such as tool support &
scalability more.
1
What are we
talking about
Reality
M1 M2 M3
SEPARATIONOFCONCERNS
M1 M2 M3
L1 L2 L3
def := … def := ∃ ⊢ #$α def := … ....
LM ∃, ⊢, #, $, α
<meta> <meta> <meta>
<meta> <meta> <meta>
LANGUAGEDEFINITION
Language Workbench
Reality
Model
MODELKINDS
<abstracts>
Reality
(Software System)
Model
MODELKINDS
describe
understand
explain
analyze
predict
prescribe
derive
manufacture
Modeling
Model-
Driven
Climate Science
Particle Physics
Social Science
FEM Models
Manufacturing
Construction
Software Eng
Automated
Reality
Model
MODELDRIVENSE
Language
Reality
Model
Language
Reality
Model
Language
<abstracts>
<abstracts>
<abstracts>
<meta>
<meta>
<meta>
What-ness
Model
MODELDRIVENSE
Language
Reality
Model
Language
Reality
Model
Language
<abstracts>
<abstracts>
<abstracts>
<meta>
<meta>
<meta>
What-ness
Model
Programming Language
Model
MODELDRIVENSE
Language
<abstracts>
<meta>
What-ness
Program
Programming Language
Programming is just
model-driving using a
programming language.
And caring about
particular concerns.
P ⊂ M
MODELDRIVENSE
Reality
Model
Language
Execution
Model
Analysis
Aligning the Semantics of
the two and is key.
MODELPURPOSE
Reality
Model
Language
Execution
Model
Analysis
…
Review
Inspect
Analyze
Simulate
…
Diverse reasons why you would want to model
beyond reducing the coding effort by generating
the implementation from more concise models.
MODELPURPOSE
Reality
Model
Language
Execution
Model
Analysis
…
Review
Inspect
Analyze
Simulate
…
Automated
Automated Execution
is essential to ”connect”
the models to the
actual system.
But:
2
Model-Driving vs.
Programming
Programming vs. MD: What it can be
3
Examples
Data changes.
The Type System supports temporal data natively.
Law changes over the years.
The payroll calculations have to follow.
Visualizations.
Of relationships between subdomains.
Performance Security
Contracts +
ProtocolsSafety
4
Language
Workbenches
MPS Language Workbench
Language Workbench
Open Source, by Jetbrains
Very Expressive
Used for years in industry
Vast Experience
MPS Language Workbench
MPS: Notational Freedom
100% crucial for acceptance in domain!
Rabbit Hole
Modeling is more than diagrams!
Handling Complexity: Language Modularity
New Language
GPL Extension
Existing
Domain Notation
(Informal)
Formalization
Formalized
Language
Reuse GPL incl. Expressions and TS
Add/Embed DS-extensions
Compatible notational style
Reduce to GPL
Analyze Domain to find Abstractions
Define suitable, new notations
Rely on existing behavioral paradigm
Reuse standard expression language
Interpret/Generate to one or more GPLs
Use existing notation from domain
Clean up and formalize
Generate/Interpret
Often import existing „models“
Handling Complexity: Growing Languages
New Language
GPL Extension
Existing
Domain Notation
(Informal)
Formalization
Formalized
Language
Reuse GPL incl. Expressions and TS
Add/Embed DS-extensions
Compatible notational style
Reduce to GPL
Analyze Domain to find Abstractions
Define suitable, new notations
Rely on existing behavioral paradigm
Reuse standard expression language
Interpret/Generate to one or more GPLs
Use existing notation from domain
Clean up and formalize
Generate/Interpret
Often import existing „models“
35+ Modular C Extensions
Handling Complexity: Growing Languages
New Language
GPL Extension
Existing
Domain Notation
(Informal)
Formalization
Formalized
Language
Reuse GPL incl. Expressions and TS
Add/Embed DS-extensions
Compatible notational style
Reduce to GPL
Analyze Domain to find Abstractions
Define suitable, new notations
Rely on existing behavioral paradigm
Reuse standard expression language
Interpret/Generate to one or more GPLs
Use existing notation from domain
Clean up and formalize
Generate/Interpret
Often import existing „models“
Partial Embedding of KernelF
Restriction
Modular Extension
Composition
(Sep. of Concerns)
Language Workbench - Convecton
Browser · Cloud · Collaborative
Multi-Notation · Language Modularity
Language Workbench - Convecton
Language Workbench - Convecton
TU Delft
itemis/Typefox
CWI Amsterdam
Solmi/Persiani
Rascal
The Whole
Platform
Other Language Workbenches
Metacase
RWTH Aachen
5
Lessons Learned
Language
Great IDE
Analyses
Refactorings
Testing
Debuggers
Abstractions
Notations
Syntax Coloring
Code Completion
Goto Definition
Collaboration
Migration
Relevant
Good Errors
Type System!
Aligned with Processes
Write Tests
Run them in IDE
Report Back
Animate Execution
Simulators
GOOD
GREAT
More than Language
Tracer/Debugger
Specification: mbeddr contracts
Analysis:
Model
Checking
C Code
Specification: KernelF
Analysis: SMT Solving of Expressions
Specification: Medical Project
Test: Run Tests directly in the IDE
Specification: NuSMV extensions (Dan Ratiu)
Reliability
6
Wrap Up
Everything on the
same platform!
No Tool Interop Problems!
Common, Good ( ) IDE support.
Properties from Mod‘ing + Prog‘ing .
Language Composition & Reuse.
and
mostly
free
... is what I call a
Model
{
{Mogram
Prodel
Everything on the
MPS platform!
Fusing Modeling and Programming into Language-Oriented Programming

Fusing Modeling and Programming into Language-Oriented Programming