Skip to content

Latest commit

 

History

History
637 lines (632 loc) · 29.6 KB

result.md

File metadata and controls

637 lines (632 loc) · 29.6 KB

Domain-Specific Languages

--- Material * * * git clone * https://github.com/acherm/teaching-MDE-IL1819 --- * IDM (MDE) * in practice ---

---

# Online Generator --- # Variant

Guillaume Bécan, Mathieu Acher, Jean-Marc Jézéquel, and Thomas Menguy. On the Variability Secrets of an Online Video Generator (2015). In VaMoS'15 --- ---

* Generator * ~ composition of video sequences ### video variants ---

* Generator * ~ composition of video sequences ### video variants ---

* Website/online * Random generation * Configurator * Game * … ---

---

## #1 How to design, create, and support dedicated languages (DSLs)? ## #2 How to transform models/programs? ## #4 How do frameworks internally work? ## #3 How to manage variability/variants? ---

## #1 How to design, create, and support dedicated languages (DSLs)? ## #2 How to transform models/programs? ## #4 How do frameworks internally work? ## #3 How to manage variability/variants? --- # Plan * Domain-Specific Languages (DSLs) * Languages and abstraction gap * Examples and rationale * DSLs vs General purpose languages, taxonomy * External DSLs * Grammar and parsing * Xtext * DSLs, DSMLs, and (meta-)modeling --- # Contract * Better understanding/source of inspiration of software languages and DSLs * Revisit of history and existing languages * Foundations and practice of Xtext * State-of-the-art language workbench (Most Innovative Eclipse Project in 2010, mature and used in a variety of industries) * Models and Languages * Perhaps a more concrete way to see models, metamodels and MDE (IDM in french) --- * What are DSLs * Where are DSLs * Why DSLs (will) matter --- The (Hi)Story of Software Engineering / Computer Science

--- * Infinite tape divided into Cells (0 or 1) * Read-Write Head * Transitition rules

Turing Machine

* Write a symbol * or move to left (>>) or right (<<) --- ## Turing Machine ~ kind of state machine --- ## Successor (add-one) function assuming that number n as a block of n+1 copies of the symbol ‘1’ on the tape (here, n=3) --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- Question: what does it compute? --- * function succ (n) { * return n + 1; * } ## (lambda (x) (+ x 1)) --- ## Successor (add-one) function assuming that number n as a block of n+1 copies of the symbol ‘1’ on the tape (here, n=3) --- Addition of n+m

* http://graphics.stanford.edu/~seander/bithacks.html * Maybe you prefer to use bit operations? --- The (Hi)Story of Software Engineering / Computer Science

---

* Software * Languages

--- ## Programming the Turing Machine Why aren’t we using tapes, states and transitions after all ?

* Distributed systems * Thousands of engineers/expertise * Web dev. * Large-scale systems * Critical Systems

## Complex Systems --- ## Programming the Turing Machine Why aren’t we using tapes, states and transitions after all ?

## You cannot be serious ---

## Formulas are Turing complete ---

## Formulas are Turing complete ### http://fr.slideshare.net/Felienne/spreadsheets-are-code-online ## Youtube video https://t.co/RTfJAxXYaX --- Esoteric programming languages * Designed to test the boundaries of computer programming language design, as a proof of concept, as software art, or as a joke. * extreme paradigms and design decisions * Eg https://esolangs.org/wiki/Brainfuck * Usually, an esolang's creators do not intend the language to be used for mainstream programming. --- (brainfuck) What does it compute? * ++++++++++[>+++++++>++++++++++>+++<<<-]>++.>+.+++++++ * ..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+. --- # Questions to the audience * Why assembly language is not the mainstream language? * Why spreadsheets are not used for building Google? * Why esoteric languages are not used for mainstream programming? * The answer to such « though-provoking » questions seems obvious at first glance * Help to define the good properties of software languages we expect * Help to understand why there is still innovation in language design --- ## Programming the Turing Machine Why aren’t we using tapes, states and transitions after all ?

## Software Languages * Hard to write and understand. * No abstractions. * Hard to debug and test. * Poor language constructs. Poor tooling support. * Performance. * Usability, productivity, reusability, safety, expressiveness, learnability. --- Question: what does it compute? ## Performance, usability, productivity, reusability, safety, expressiveness, learnability. --- Qualities and challenges * Cognitive dimensions (see references after) * Abstractions * Eg Kramer “Abstraction and Modelling - A Complementary Partnership” MODELS’08 * Separation of concerns/modularity * Eg Tarr et al., ICSE’99 * Scalability * Growing a language (like Scala) * Performance * … ---

# Languages

# Complex Systems

--- # We need languages * At a high level of abstraction * Still general-purpose * Generation of other artefacts written in other languages * Transformation, refinement * Multiplicity of languages * Divide and conquer * Specific to a problem or “domain” * Induce a way to “compose” languages * (Combemale et al. “On the Globalization of Domain-Specific Languages”) ---

* “Even variations in grammar can profoundly affect how we see the world.” * She’s talking about real languages; what about synthetic, programming languages? --- # What is a language? * « A system of signs, symbols, gestures, or rules used in communicating » * « The special vocabulary and usages of a scientific, professional, or other group » * « A system of symbols and rules used for communication with or between computers. » --- Architecture

# Architecture --- Cartography

# Cartography --- Biology

# Biology --- Electronics

# Electronics --- # In Software Engineering ## « Languages are the primary way in which system developers communicate, design and implement software systems »  ---

* General Purpose * Languages * Assembly ? * COBOL ? LISP ? C ? C++ ? * Java? PHP ? C# ? Ruby ? --- ## Limits of General Purpose Languages (1) Abstractions and notations used are not natural/suitable for the stakeholders 

--- Not targeted to a particular kind of problem, but to any kinds of software problem.

## Limits of General Purpose Languages (2) --- * Targeted to a particular kind of problem, with dedicated notations (textual or graphical), support (editor, checkers, etc.) * Promises: more « efficient » languages for resolving a set of specific problems in a domain

## Domain Specific Languages --- ## A discussable view (slide “OptiML…” Sujeeth et al., ICML’11)

--- * Long history: used for almost as long as computing has been done. * You’re using DSLs in a daily basis * You’ve learnt many DSLs in your curriculum * Examples to come! ## Domain Specific Languages (DSLs) --- # HTML Domain: web (markup)

--- # CSS Domain: web (styling)

--- # SQL Domain: database (query)

--- # Makefile Domain: software building

--- # Lighthttpd configuration file Domain: web server (configuration)

--- # Graphviz Domain: graph (drawing)

--- # PGN (Portable Game Notation) Domain: chess (games)

--- # Regular expression Domain: strings (pattern matching)

--- # Question to the audience ## Give three examples of domain-specific languages (DSLs) --- Domain: model management * self.questions->size * self.employer->size * self.employee->select (v | v.wages>10000 )->size * Student.allInstances * ->forAll( p1, p2 | * p1 <> p2 implies p1.name <> p2.name ) # OCL --- UML can be seen as a collection of domain-specific modeling languages

# Behavioral # Structural --- * Problem * Space * Solution * Space ## Assembler ## C, Java ## DSLs # Abstraction Gap --- * « Another lesson we should have learned from the recent past is that the development of 'richer' or 'more powerful' programming languages was a mistake in the sense that these baroque monstrosities, these conglomerations of idiosyncrasies, are really unmanageable, both mechanically and mentally. * I see a great future for very systematic and very modest programming languages » * ACM Turing Lecture, « The Humble Programmer » Edsger W. Dijkstra ## aka General-Purpose Languages ---

## « Domain-specific languages are far more prevalent than anticipated » ---

--- What is a domain-specific language ? * « Language specially designed to perform a task in a certain domain » * « A formal processable language targeting at a specific viewpoint or aspect of a software system. Its semantics and notation is designed in order to support working with that viewpoint as good as possible » * « A computer language that's targeted to a particular kind of problem, rather than a general purpose language that's aimed at any kind of software problem. » --- * A GPL provides notations that are used to describe a computation in a human-readable form that can be translated into a machine-readable representation. * A GPL is a formal notation that can be used to describe problem solutions in a precise manner. * A GPL is a notation that can be used to write programs. * A GPL is a notation for expressing computation. * A GPL is a standardized communication technique for expressing instructions to a computer. It is a set of syntactic and semantic rules used to define computer programs. # GPL (General Purpose Language) --- What is offered? ## Promises of domain-specific languages --- ## Promises of domain-specific languages --- General PLs vs Domain-SLs

The boundary isn’t as clear as it could be. Domain-specificity is not black-and-white, but instead gradual: a language is more or less domain specific

# GeneralPL vs DomainSL --- * Promises of DSL« improvement » in terms of * usability, learnability, expressiveness, reusability, etc. * Empirical study on the role of syntax * C-style syntax induces problems in terms of usability for novices; language more or less intuitive for (non-)programmers (Stefik et al. 2014) * Syntax issues with Java for students (Denny et al. 2011) * PL usability: method namings/placement, use of identifiers, API design (Ellis et al., Styllos et al., Clarke, Montperrus et al., etc.) * More specialized/sophicated tools/IDE can be derived from a DSL * editors, compilers, debuggers ## Specializing syntax and environment pays off? --- # Question to the audience * Take one DSL and formulate assumptions on their qualities (and superiority to a GPL-based solution) * Imagine an experience for providing evidence that the DSL has such qualities --- External DSLs vs Internal DSLs * An external DSL is a completely separate language and has its own custom syntax/tooling support (e.g., editor) * An internal DSL is more or less a set of APIs written on top of a host language (e.g., Java). * Fluent interfaces --- ## External vs Internal DSL (SQL example)

--- Internal DSL (LINQ/C# example)

--- Internal DSL * « Using a host language (e.g., Java) to give the host language the feel of a particular language. » * Fluent Interfaces * « The more the use of the API has that language like flow, the more fluent it is »

--- ## SQL in… Java DSL in GPL --- ## Regular expression in… Java DSL in GPL --- Internal DSLs vs External DSL * Both internal and external DSLs have strengths and weaknesses * learning curve, * cost of building, * programmer familiarity, * communication with domain experts, * mixing in the host language, * strong expressiveness boundary * Focus of the course * external DSL a completely separate language with its own custom syntax and tooling support (e.g., editor) --- # Question to the audience # Find a DSL that is both internal and external --- HTML * External DSL: …. * Internal DSLs * LISP * Scala (XML support included in the language)

---

https://github.com/julienrf/glitter ### TCS Wyvern (Omar et al., OOPLSA’14) ### Scala --- # SQL

--- # Homework --- # Homework * Jhipster (http://www.jhipster.tech/), let us consider the “last” version (November 5, 2018) * How many languages are used in such a contemporary project? * List all software languages used in Jhipster * Classify them (GPL? External DSL? Internal DSL?) * Don’t forget APIs that look like (internal) DSLs * https://tinyurl.com/jhipster-IL-langs1819 * (expand/modify the sheet; deadline: next course) --- References * Martin Fowler. Domain Specific Languages. Addison-Wesley Professional, 2010. * Markus Voelter et al. “DSL Engineering: Designing, Implementing and Using Domain-Specific Languages.” dslbook.org, 2013. * Kramer “Abstraction and Modelling - A Complementary Partnership” MODELS’08 * Tarr et al. “N Degrees of Separation: Multi-Dimensional Separation of Concerns” ICSE’99 * Benoit Combemale, Julien Deantoni, Benoit Baudry, Robert France, Jean-Marc Jézéquel, and Jeff Gray. « Globalizing Modeling Languages.” Computer, 2014. --- References * Leo A Meyerovich and Ariel S Rabkin. “Empirical analysis of programming language adoption” OOPSLA’13 * Felienne Hermans, Martin Pinzger, and Arie van Deursen. “Domain-Specific languages in practice: A user study on the success factors.“ MODELS’09 * Paul Denny, Andrew Luxton-Reilly, Ewan Tempero, and Jacob Hendrickx. “Understanding the syntax barrier for novices.” ITiCSE ’11 * Tiark Rompf et al . “Optimizing Data Structures in High-Level Programs: New Directions for Extensible Compilers based on Staging” POPL’13

References

  • Mathieu Acher, Benoît Combemale, Philippe Collet: “Metamorphic Domain-Specific Languages: A Journey into the Shapes of a Language.” Onward! 2014
  • Jeffrey Stylos and Brad A. Myers. “The implications of method placement on api learnability” FSE’08
  • Martin Monperrus, Michael Eichberg, Elif Tekes, and Mira Mezini. “What Should Developers Be Aware Of? An Empirical Study on the Directives of API Documentation”. Empirical Software Engineering, 17(6):703–737, 2012.

Plan

  • Domain-Specific Languages (DSLs)
    • Languages and abstraction gap
    • Examples and rationale
    • DSLs vs General purpose languages, taxonomy
  • External DSLs
    • Grammar and parsing
    • Xtext
  • DSLs, DSMLs, and (meta-)modeling

Contract

  • Better understanding/source of inspiration of software languages and DSLs
    • Revisit of history and existing languages
  • Foundations and practice of Xtext
    • State-of-the-art language workbench (Most Innovative Eclipse Project in 2010, mature and used in a variety of industries)
  • Models and Languages
    • Perhaps a more concrete way to see models, metamodels and MDE (IDM in french)