Is programming = modeling? Are there differences, conceptual and tool-wise? Should there be differences? What if we programmed the way we model? Or vice versa? In this slidedeck I explore this question and introduce interesting developments in the space of projectional editing and modern parser technology. This leads to the concept of modular programming languages and a new way of looking at programming. I will demonstrate the idea with tools that are available today, for example TMF Xtext, JetBrains MPS and Intentional’s Domain Workbench.
Transcript of From Programming to Modeling And Back Again
Programming Modeling
fromto
…and back again
Markus VoelterIndependent/itemis
voelter@acm.org
A Journey…
„Houston,we have a
Problem!“
Programming Languages
C# C++ Java
Python
GroovyRubyErlang
CFortran
Programming Languagesare not
enough.expressive
C# C++ Java
Python
GroovyRubyErlang
CFortran
Programming Languagesare not
enough.high-level
C# C++ Java
Python
GroovyRubyErlang
CFortran
Programming Languagesare not
enough.abstract
C# C++ Java
Python
GroovyRubyErlang
CFortran
Programming Languagesare not
enough.domain-specific
C# C++ Java
Python
GroovyRubyErlang
CFortran
Programming Languagesare notenough.
C# C++ Java
Python
GroovyRubyErlang
CFortran
Programming LanguagesFormats
C# C++ Java
Python
GroovyRubyErlang
CFortranHTML
XMLCSSyaml
json
Programming LanguagesFormats
C# C++ Java
Python
GroovyRubyErlang
CFortranHTML
XMLCSSyaml
json JEEWPF
Rails
Django
JMS
lift
Frameworks
Programming LanguagesFormats
C# C++ Java
Python
GroovyRubyErlang
CFortranHTML
XMLCSSyaml
json JEEWPF
Rails
Django
JMS
lift
Frameworksare not enough.
not enough?for what?
not enough?for what?
not enough?for what?
So?
Modeling… Higher Level… Domain Specific
Interpretation… Code Generation
Concepts & Notations
Modeling… Higher Level… Domain Specific
Interpretation… Code Generation
Concepts & Notations
Solves theProblem!
But:
Modeling Tools Programming Tools
!=
Different Worlds
Modeling ToolModeling 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
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
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
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
Modeling
… (Mostly) Graphical Notations
… Abstract Syntax Storage
… Projecting Editors
… Different editable views 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 ProgrammingProgramming Modeling
====
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