erlang c++ ruby c - jugs€¦ · erlang fortran c programming languages are not enough. high-level...
TRANSCRIPT
06.11.2009
1
Programming Modeling
from
to
Markus VoelterIndependent/itemis
Programming Modeling
from
to
…and back again
Markus VoelterIndependent/itemis
„Houston,we have a
Problem!“
Programming Languages
C# C++
JavaPython
GroovyRuby
Erlang
CFortran
06.11.2009
2
Programming Languagesare not
enough.expressive
C# C++
JavaPython
GroovyRuby
Erlang
CFortran
Programming Languagesare not
enough.high-level
C# C++
JavaPython
GroovyRuby
Erlang
CFortran
Programming Languagesare not
enough.abstract
C# C++
JavaPython
GroovyRuby
Erlang
CFortran
Programming Languagesare not
enough.domain-specific
C# C++
JavaPython
GroovyRuby
Erlang
CFortran
Programming Languagesare notenough.
C# C++
JavaPython
GroovyRuby
Erlang
CFortran
Programming LanguagesFormats
C# C++
JavaPython
GroovyRuby
Erlang
CFortran
HTML
XMLCSSyaml
json
06.11.2009
3
Programming LanguagesFormats
C# C++
JavaPython
GroovyRuby
Erlang
CFortran
HTML
XMLCSSyaml
json
JEEWPF
Rails
Django
JMS
lift
Frameworks
Programming LanguagesFormats
C# C++
JavaPython
GroovyRuby
Erlang
CFortran
HTML
XMLCSSyaml
json
JEEWPF
Rails
Django
JMS
lift
Frameworksare not enough.
So?
Modeling
Modeling… Higher Level
… Domain Specific
Interpretation… Code Generation
Concepts & Notations
Modeling… Higher Level
… Domain Specific
Interpretation… Code Generation
Concepts & Notations
Solves theProblem!
06.11.2009
4
But:Modeling Tools
Programming Tools!=
Different Worlds
Modeling Tool
Modeling Tool!=
Different Worlds Different WorldsMix Models and Programs
Different WorldsAST Navigation & Query
Mix Models and Programs
Different WorldsAST Navigation & Query
Mix Models and Programs
Integration of 3GL code
06.11.2009
5
Different WorldsAST Navigation & Query
Mix Models and Programs
Integration of 3GL codeCode Constraints pareCom
pareCom
Domain SpecificNotations
andAbstractions
LibrariesFrameworks
(Fluent) APIs
Flexible! Limited!
GraphicalTextual
FormsTables
TextualTrees
Limited!Flexible!
CustomizeGenerator
orInterpreter
Limited!Flexible!
ReflectionMeta ProgramsOpen Compilers
06.11.2009
6
Define customQueryorNavigate
Limited!Flexible!
AST APIsStatic Analysis
Transformor
Regex
CustomValidationorError Checks
Limited!Flexible!
IDE pluginsStatic AnalysisOpen Compilers
DifferentRepresentations
andProjections
Limited!Flexible!
Text is TextCode FoldingTree ViewsVisualizations
Limited!Flexible?
Python-to-C-likeInternal DSLs
Mixingand
ComposingLanguages
Embed-As-StringSpecific: LINQ
Mature!Brittle!
IDE Support
Scalable
Modeling Tools…!?
Usable
Mature!Brittle!
Testing
Debugging
?
Refactoring
06.11.2009
7
Mature!Brittle!
Branching
VersioningDiff, Merge
for some tools…
Gets theGets some
some people doubt that…
Job Done!Jobs done.everybody agrees…
Whythe difference?
History?
Modeling Programming Modeling Programming
… (Mostly) Textual Notations
… Concrete Syntax Storage
… (Fancy) ASCII Editors
… Read-Only Visualizations
06.11.2009
8
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?
It is time for … … a Different Perspective
Programmingthe way we do
Modeling?
Modelingthe way we do
Programming?
Modeling Programming
Programming Modeling
====
06.11.2009
9
Where do we go from here?
We don‘t want to
we want tomodel,
program!
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
06.11.2009
10
We don‘t want to
we want tomodel,
program!
precise and tool processableAnd always:
EnablingTechnologies
EnablingTechnologies
AvailableTooling
A vision forprogramming
EnablingTechnologies
AvailableTooling
06.11.2009
11
EnablingTechnologies
EnablingTechnologies
AdvancedParser
Generators
Modeling as Programmig
… (Mostly) Textual Notations
… Concrete Syntax Storage
… (Fancy) ASCII Editors
… Read-Only Visualizations
Custom Syntax
GraphicalTextualSymbolic++
IDESupport
TeamworkDebuggingCustom Editors
CompleteSymbolicIntegration
Goto DefFind RefsRefactoring
06.11.2009
12
Xtext-like Toolsprovide editor support
TeamworkCustom Editors
Goto DefFind Refs
Refactoring
UnicodeLimited to
how to handlenon-character symbols
TextGraphics !=
two worlds…
separate editors… per syntax/viewpoint… models can still be ref integrated
EnablingTechnologies
ProjectionalEditing
Parser-basedtext… to tree… to text
06.11.2009
13
Projectionaltree… to text-lookalike (editor)… to other trees … **+… to text
Programming as Modeling
… (Mostly) GraphicalNotations
… Abstract Syntax Storage
… Projecting Editors
… Different editableviews for model
Programming as Modeling
… (Mostly) Graphical Any kind ofNotations
… Abstract Syntax Storage
… Projecting Editors
… Different editableviews for model
Language
There‘s no parsing.
Unique Language Element Identity.
Unlimted language composition.
Composition
Textual
Graphical
Semi-Graphical
treated the same
can be mixed
like ASCII }box & line
mathematical
Flexible
NotationsAutomatic
IDE Extensiontool support is inherent
for languages build withprojectional tools
language definition
IDE definitionimplies
06.11.2009
14
MultipleNotations
… for the same concepts
e.g. in different contextsor for different tasks
PartialProjections
… different views… for different roles/people… only a particular variant
Storage!= Schema
… independent of language schema!variability annotations
… store arbitraty meta datachange logconflicting information
… „aspects“, overlay
ProgramsLive
think: spreadsheet
a change to one part of programcan lead to (dependent) changesin other parts
Tree Editing
… try to make it feel like text
… takes some getting used tobut: for more flexible notations a more general editing paradigm is needed
… is different from editing text
InfrastructureIntegration
… diff/merge must be in tool
… existing text tools don‘t work
… storage is not text
06.11.2009
15
ProprietaryTools
… no interop
… no standards
AvailableTooling
AvailableTooling
Eclipse
Xtext
http://eclipse.org/modeling http://eclipse.org/xtext
06.11.2009
16
Xtext: Specify Grammar Xtext: Gen. Meta Model
Xtext: Constraints Xtext: Generated Editor
Code Completion
Xtext: Generated Editor
Syntax ColoringCustom Keyword Coloring
Xtext: Generated Editor
06.11.2009
17
Realtime ConstraintValidation
Xtext: Generated Editor
CustomizableOutlines
Xtext: Generated Editor
Code Folding
Xtext: Generated Editor
Goto Definition Find ReferencesCross-File ReferencesModel as EMF
Xtext: Generated Editor
Xtext: Generated Editor
06.11.2009
18
DEMO I
Building DSLs with Eclipse Xtext
AvailableTooling
AvailableTooling
Jetbrains‘
ProgrammingMeta
System
IntelliJ IDEAResharper
also do…
Q3 2009released in
1.1 RC1currently
06.11.2009
19
Apache 2.0licensed under
Build new standalone DSLs
Build new standalone DSLsBuild DSLs that reuse parts
of other languages
Build new standalone DSLsBuild DSLs that reuse parts
of other languages
(MPS comes with BaseLanguage)
extend base language
Java++
Build new standalone DSLsBuild DSLs that reuse parts
of other languages
(MPS comes with BaseLanguage)
extend base languagebuild DSLs that reuse parts
of BaseLanguage
Java++
Java + Extension
Language Extension Example
06.11.2009
20
Java
ReadWriteLock l = …
l.readLock().lock();
try {
//code
} finally {
l.readLock().unlock();
}
Java + Extension
Language Extension Example
Old Java
ReadWriteLock l = …
l.readLock().lock();
try {
//code
} finally {
l.readLock().unlock();
}
Java + Extension
ReadWriteLock l = …
lock (l) {
//code
}
Language Extension Example
Old New
Structure Editor Typesystem Generator Structure Editor Typesystem Generator
Structure Editor Typesystem Generator Structure Editor Typesystem Generator
06.11.2009
21
Structure Editor Typesystem Generator Structure Editor Typesystem Generator
Structure Editor Typesystem Generator Structure Editor Typesystem Generator
Structure Editor Typesystem Generator Language Extension ExampleResult behaves like a native
base language construct
06.11.2009
22
Language Extension ExampleResult behaves like a native
base language construct
Language Extension ExampleTranslated to regular Java code
based on the generator
package jaxdemo.sandbox.sandbox;
import java.util.concurrent.locks.Lock;
public class DemoClass {
private Lock lock;
public DemoClass() {try {this.getLock().lock();SharedResouce.instance().doSomething();
} finally {this.getLock().unlock();
}}
private Lock getLock() { return this.lock; }
}
Example LanguagesUI Language
Example LanguagesHTML Templates
Example LanguagesPersistent Classes
06.11.2009
23
DEMO II
Building DSLs with JetBrains MPS
A vision forProgramming
Programming Languages
are not
enough.MODULAR
Programming Languages
are not
enough.COMPOSABLE
06.11.2009
24
Programming Languages
are not
enough.CONFIGURABLE
Programming Languages
are not
enough.ADAPTABLE
Programming Language Syntax
is not
enough.FLEXIBLE
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
my L
a b c
d e f
g h i
j k l
Modular Language
composable conceptswith many optional,
06.11.2009
25
Like frameworksand libraries,
Modular Language
Like frameworksand libraries,
but with syntaxand IDE support
Modular Language
Not a new idea…
Growing A Language(Guy L Steele)
06.11.2009
26
LanguageWorkbench
(Martin Fowler)
LanguageWorkbench
(Martin Fowler)
Freely
define
integratethem
languages and ?
LanguageWorkbench
(Martin Fowler)
usepersistent
abstractrepresentation
LanguageWorkbench
(Martin Fowler)
language ::=
schemaeditors
generators+
+
?
LanguageWorkbench
(Martin Fowler)
editingprojectional
06.11.2009
27
LanguageWorkbench
(Martin Fowler)
persist
incomplete
contradictoryinformation
or
LanguageWorkbench
(Martin Fowler)
powerful
editingtesting
refactoringdebugging
language definition
IDE definitionimplies
+groupware
LanguageWorkbench
(Martin Fowler)
support for„classical“
programming„classical“
modelingand
+Syntax
primarilytextual
Syntaxprimarilytextual
with more symbolsthink: mathematics
Syntaxprimarilytextual
sometimesbox&line style
06.11.2009
28
Syntaxprimarilytextual
sophisticatedvisualizations
Viewpoints
Viewpointssuitable
abstractions
notationsfor each
and
Viewpoints
Integrated
references
transitions
symbolic
seamlessand
via
ViewpointsBusiness
custompurpose-built
create/include
Viewpoints
CustomNotations
businessexpert integration
real
Business
06.11.2009
29
Viewpoints
CustomNotations
businessexpert integration
real
Business
But that‘s another talk…
ViewpointsTechnical
predefinedlibrary
configure
Example Languages
06.11.2009
30
06.11.2009
31
06.11.2009
32
06.11.2009
33
matricesAdding
embeddedto C in an
environment.
(Seemingly)
Simple Example
Currently:
1• Declare Data Structures in XML
2• Generate Headers
3• Implement manually in C
Currently:
Matrices
and generator
not supportedin XML format
06.11.2009
34
Currently:
Tool team
… a lot of work
would have todo the extension
… busy… one central tool
Currently:
No real
… type checks
compiler supportin the resulting C code
… operator overloading… generics (matrix<int>)… matrix syntax?
Better Solution
Better Solution
types
matrixgeneric
vectorand
Better Solution
matrixreal
literalsvector
and
06.11.2009
35
Better Solution
highlightssyntax
vectorsfor
and
matrices
Better Solution
operatoroverloading
Better Solution
operatoroverloading
staticoptimization… symmetrical matrices… identity matrix… diagonal matrices
Better Solution
mathnotation
Better Solution
used only bythose who
separatea
modulelanguage
really need it
06.11.2009
36
In addition: PLE Variability
variabilityannotating
expressionsto
arbitraryregions
In addition: PLE Variability
variabilityannotating
expressionsto
arbitraryregions
statically checked
In addition: PLE Variability
variabilityannotating
expressionsto
arbitraryregions
projectvariant
AvailableTooling
AvailableTooling
Intentional SoftwareDomain
Workbench
06.11.2009
37
Dec 15, 2008Version 1.0 released in
currently at 1.4
CommercialProduct
Eval availableupon request
Statemachine Example
Nat
ive
Pro
ject
ion
Statemachine Example
Tab
ula
r P
roje
ctio
n
06.11.2009
38
Statemachine Example
Text
ual
DSL
Pro
ject
ion
Statemachine Example
Java
Pro
ject
ion
Statemachine Example
Ru
by
Pro
ject
ion
Statemachine Example
Two
pro
ject
ion
s si
de
/sid
e
Statemachine Example
Two
pro
ject
ion
s si
de/
sid
e
06.11.2009
39
Pension Workbench Example
Text Editing Domain
Pension Workbench Example
Insurance Mathematics Domain
Pension Workbench Example
Pension Contract Rules Domain
Pension Workbench Example
All in one Document
Pension Workbench Example
Symbolically integrated
06.11.2009
40
A Journey…
Are we there?
A Journey…
web email skype
xinglinkedin
http://www.xing.com/profile/Markus_Voelterhttp://www.linkedin.com/pub/0/377/a31
.coordinates
one more thing…
06.11.2009
41
http://sioux.nl
Feb 3 – 4, 2010
Domain Specific Languages (for Product Lines)
Eindhoven, NL
Sioux Embedded Systems
http://itemis.de
12./13.11.2009: Hamburg18./19.02.2010: Hamburg25./26.02.2010: Stuttgart
15./16.04.2010: München
Xtextitemis
http://bit.ly/3gRt8l
http://itemis.de
23./27.11.2009: Bonn30./04.12.2009: München
Eclipse Modeling (GEF, EMF, GMF)itemis
http://bit.ly/2n9H9j
THE END. Really.