104
The Art of Building Tools A Language Engineering Perspective http://voelter.de [email protected] @markusvoelter Markus Voelter independent/itemis

The Art of Building Tools

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The Art of Building Tools

The Art of Building Tools

A Language Engineering Perspective

http://voelter.de [email protected] @markusvoelter

Markus Voelter independent/itemis

Page 2: The Art of Building Tools

1

2

3

Tool Extension

Ex: mbeddr

GTSL

4

5

6

Ex: Requirements

Wrap Up

Ex: Insurance

Page 3: The Art of Building Tools

1 Tool Extension

Page 4: The Art of Building Tools

„Tool Extensibility

Study Findings I “The  majority  of  our  interviewees  were  very  successful  with  MDE  but  all  of  them  either  built  their  own  modeling  tools,  made  heavy  adapta2ons  of  off-­‐the-­‐shelf  tools,  or  spent  a  lot  of  ?me  finding  ways  to  work  around  tools.  The  only  accounts  of  easy-­‐to-­‐use,  intui?ve  tools  came  from  those  who  had  developed  tools  themselves  for  bespoke  purposes.  Indeed,  this  suggests  that  current  tools  are  a  barrier  to  success  rather  than  an  enabler.  

Page 5: The Art of Building Tools

„Tool Extensibility

Study Findings II “Complexity  problems  are  typically  associated  with  off-­‐the-­‐  shelf  tools.  Of  par?cular  note  is  accidental  complexity  –  which  can  be  introduced  due  to  [..]  [the]  lack  of  flexibility  to  adapt  the  tools  to  a  company’s  own  context  [..]  

Page 6: The Art of Building Tools

„Tool Extensibility

Study Findings III “Our  interviews  point  to  a  strong  need  for  tailoring  of  some  sort:  either  tailor  the  tool  to  the  process,  tailor  the  process  to  the  tool,  or  build  your  own  tool  that  naturally  fits  your  own  process.  Based  on  our  data,  it  seems  that,  on  balance,  it  is  currently  much  easier  to  do  the  laNer.    

Page 7: The Art of Building Tools

Tool Extensibility

Command-Line Tools

New File Formats New Processors

Assemble Components (Pipes & Filters)

Page 8: The Art of Building Tools

Tool Extensibility

UI Tools

Buttons Menus

Views Actions

(New Languages) (New Editors)

Platform/Plugin Systems

Page 9: The Art of Building Tools

2 mbeddr

Page 10: The Art of Building Tools

   

An Example System

Language Engineering Embedded Software

Specific Languages

Page 11: The Art of Building Tools

   

An Example System

Language Engineering Embedded Software

Specific Languages

A collection of integrated languages for embedded software engineering.

Page 12: The Art of Building Tools

   

An Example System

Language Engineering Embedded Software

An extensible collection of integrated languages

Specific Languages

for embedded software engineering.

Page 13: The Art of Building Tools

   

An Example System

Language Engineering Embedded Software

Specific Languages

An IDE for all Of them

Page 14: The Art of Building Tools

   

An Example System

Language Engineering Embedded Software

Open Source Eclipse Public License http://mbeddr.com

Specific Languages

Page 15: The Art of Building Tools

   

About mbeddr

Built on JetBrains MPS

Open Source Apache 2.0 http://jetbrains.com/mps

Generic Tool

Page 16: The Art of Building Tools

   

About MPS

Rich Set of Language Aspects

+ Refactorings, Find Usages, Syntax Coloring, Debugging, ...

Generic Tool

Page 17: The Art of Building Tools

   

About MPS

Projectional Editing Parsing Projection

Generic Tool

Page 18: The Art of Building Tools

   

About MPS

Notational Flexibility

Regular Code/Text Mathematical

Tables Graphical

Generic Tool

Page 19: The Art of Building Tools

   

About MPS

Language Composition

L2   L1  

Separate Files In One File

Type System Transformation Constraints

Type System Transformation Constraints Syntax Editor/IDE

Generic Tool

Page 20: The Art of Building Tools

   

An Example System

Built on JetBrains MPS

Generic Tool

Page 21: The Art of Building Tools

   

Features

Hello, World

Messages abstract over IO. Report statements output them.

Page 22: The Art of Building Tools

   

Features

Function Types and Function Pointers

Better notation for function types and function references.

Page 23: The Art of Building Tools

   

Features

Function Types and Lambdas

And yes, we have lambdas (it‘s 2013 after all J)

Page 24: The Art of Building Tools

   

Features

Reporting

Reporting has conditions. All of it removed, when disabled!

Page 25: The Art of Building Tools

   

Features

Test Cases

Special expression to run test cases and collect failure count.

Page 26: The Art of Building Tools

   

Features

Physical Units

Types can have units; additional units can be defined.

Page 27: The Art of Building Tools

   

Features

Physical Units II

Literals can have units; type system calculates w/ units.

Page 28: The Art of Building Tools

   

Features

Physical Units III

Convertible units support *value* conversions!

Page 29: The Art of Building Tools

   

Features

Math

Support for readable mathematical symbols.

Page 30: The Art of Building Tools

   

Features

Interfaces and Components I

Interfaces define operations. Components provide interfaces.

Page 31: The Art of Building Tools

   

Features

Interfaces and Components II

Components can be instantiated and wired.

Page 32: The Art of Building Tools

   

Features

Interfaces and Components III

Interfaces can have pre- and postconditions.

Page 33: The Art of Building Tools

   

Features

Interfaces and Components IV

In addition, interfaces can have protocol state machines.

Page 34: The Art of Building Tools

   

Features

Interfaces and Components V

Components can also require ports (dependency injection)

Page 35: The Art of Building Tools

   

Features

Interfaces and Components VI

Interfaces and components can be visualized.

Page 36: The Art of Building Tools

   

Features

Interfaces and Components VIII

Mock components specify expectations in context of a test.

Page 37: The Art of Building Tools

   

Features

Interfaces and Components IX

Mocks can be instantiated and validated in tests.

Page 38: The Art of Building Tools

   

Features

Interfaces and Components X

Interface contracts can be verified statically!

Page 39: The Art of Building Tools

   

Features

Decision Tables

Decision tables nicely exploit the projectional editor.

Page 40: The Art of Building Tools

   

Features

Combinable Extensions!

C, components, units and decision tables comhined!

Page 41: The Art of Building Tools

   

Features

Decision Tables II

Decision Tables are analyzed f. consistency and completeness

Page 42: The Art of Building Tools

   

Features

State Machines I

State machines fundamentally consist of states.

Page 43: The Art of Building Tools

   

Features

State Machines II

States contain transitions with guards, and actions.

Page 44: The Art of Building Tools

   

Features

State Machines III

State machines can be instantiated; code can interact.

Page 45: The Art of Building Tools

   

Features

State Machines IV

+ special support for testing state machines.

Page 46: The Art of Building Tools

   

Features

State Machines V

Outgoing interactins via function calls or out events.

Page 47: The Art of Building Tools

   

Features

State Machines VI

Hierarchical state machines (composite states)

Page 48: The Art of Building Tools

   

Features

State Machines VII

State Machines can be visualized in various way.

Page 49: The Art of Building Tools

   

Features

State Machines VIII

Symbolic Model Checking for State Machines

Page 50: The Art of Building Tools

   

Features

Documentation

Rich, Structured Comments (note the embedded nodes)

Page 51: The Art of Building Tools

   

Features

Documentation II

Documentation Language w/ Embeddable Code (LaTeX/HTML)

Page 52: The Art of Building Tools

   

Features

Documentation III

Format Text, Reference Code, Define Glossary Terms

Page 53: The Art of Building Tools

   

Features

Documentation IV

Embeddable Expressions with Real Type Checking

Page 54: The Art of Building Tools

   

Features

Product Line Variability

Feature Models (and Checked Configs) to Express Variability

Page 55: The Art of Building Tools

   

Features

Product Line Variability II

Runtime Variability based on Feature Models

Page 56: The Art of Building Tools

   

Features

Product Line Variability III

Static Variability for any Program w/ Variant Editing

Page 57: The Art of Building Tools

Features

Tree Views I

Different Tree View Structures defined by language concepts.

Page 58: The Art of Building Tools

Features

Tree Views II

Custom Commands are supported as well.

Page 59: The Art of Building Tools

   

Features

Debugging

Debugging on the DSL Level (Extensible!)

Page 60: The Art of Building Tools

   

Features

VCS Diff/Merge

Diff/Merge on the Projected Syntax

Page 61: The Art of Building Tools

   

Features

CI Server Integration

Building Programs on Command Line/CI Server

Page 62: The Art of Building Tools

3 GTSL Generic

Tools Specific Languages

Page 63: The Art of Building Tools

Thought Process

From Data Formats To Languages

Structure, Constraints, Semantics + Syntax + IDE Data Format

Language

Page 64: The Art of Building Tools

Thought Process

Language Engineering

Languages

Language Reuse Language Modularization Language Composition Language Engineering

Page 65: The Art of Building Tools

Thought Process

Language Engineering

Languages

Language Engineering

Syntactic Diversity

Text Tables

Math Symbols

Graphics Forms

Page 66: The Art of Building Tools

Thought Process

Language Workbenches

Languages

Language Engineering

Syntactic Diversity

But does this really work? Language Workbenches

Page 67: The Art of Building Tools

Generic Tools, Specific Languages

Ingredients

Languages

Language Engineering

Syntactic Diversity

Language Workbenches Generic Tools

Specific Languages

Page 68: The Art of Building Tools

Generic Tools, Specific Languages

Ingredients

Languages

Language Engineering

Syntactic Diversity

Language Workbenches Generic Tools

Specific Languages

(we don‘t have to reimplement editors and synchronizers)

Page 69: The Art of Building Tools

Generic Tools, Specific Languages

Ingredients

Languages

Language Engineering

Syntactic Diversity

Language Workbenches Generic Tools

Specific Languages

support

Page 70: The Art of Building Tools

Language Workbenches

Typical Features

Goto Definition/Find Usages Error Markup/Quick Fixes Syntax Highlighting Code Completion Search/Replace Refactoring Debugging

Reporting Visualization

Version Control

Page 71: The Art of Building Tools

Language Workbenches

Typical Features

for any Language!

Page 72: The Art of Building Tools

Language Workbenches

Typical Features

Language Workbenches act as the foundation for IDEs for any language.

Page 73: The Art of Building Tools

„Tool Extensibility

Study Findings I “The  majority  of  our  interviewees  were  very  successful  with  MDE  but  all  of  them  either  built  their  own  modeling  tools,  made  heavy  adapta2ons  of  off-­‐the-­‐shelf  tools,  or  spent  a  lot  of  ?me  finding  ways  to  work  around  tools.  The  only  accounts  of  easy-­‐to-­‐use,  intui?ve  tools  came  from  those  who  had  developed  tools  themselves  for  bespoke  purposes.  Indeed,  this  suggests  that  current  tools  are  a  barrier  to  success  rather  than  an  enabler.  

Page 74: The Art of Building Tools

„Tool Extensibility

Study Findings II “Complexity  problems  are  typically  associated  with  off-­‐the-­‐  shelf  tools.  Of  par?cular  note  is  accidental  complexity  –  which  can  be  introduced  due  to  poor  considera?on  of  other  categories,  such  as  lack  of  flexibility  to  adapt  the  tools  to  a  company’s  own  context  [..]  

Page 75: The Art of Building Tools

Language Workbenches

Typical Features

Used by the tool vendor to build the initial tool (languages).

Used by the end user to adapt the tool (lang extensions)!

Extensions are first-class!

Page 76: The Art of Building Tools

Generic Tools, Specific Languages

Adaptability is built-in!

Extensions are first-class!

Fundamentally different from Today‘s State-of-the-Art in Tools

Page 77: The Art of Building Tools

4 Example II: Requirements

Page 78: The Art of Building Tools

   

Features

Requirements

Structured and Hierarchical Requirements.

Page 79: The Art of Building Tools

   

Features

Requirements Relationships

References to other Requirements (see Documentation lang.)

Page 80: The Art of Building Tools

   

Features

Requirements Relationship Diagram

Relationships between Requirements (downstream, upstream)

Page 81: The Art of Building Tools

   

Features

Requirements ext‘d with Business Rules

Live (interpreted) Business Rules can be Embedded in Req.

Page 82: The Art of Building Tools

   

Features

Debugging Business Rules („Live Program‘g“)

All intermediate expression values shown inline.

Page 83: The Art of Building Tools

   

Features

Code Referencing Business Rules

These Business Rules can be „called“ from C Code

Page 84: The Art of Building Tools

   

Features

Requirements with Scenarios

Requirements are Extensible, e.g. with Scenarios

Page 85: The Art of Building Tools

   

Features

Graphical Scenarios

Scenarios can be Visualized

Page 86: The Art of Building Tools

   

Features

Workpackages

An extension supports workpackages for requirements.

Page 87: The Art of Building Tools

   

Features

Workpackage Assessments

A report over the workpackages and the spent work

Page 88: The Art of Building Tools

   

Features

Requirements Tracing

Ubiquitous Tracing from Arbitrary Program Elements

Page 89: The Art of Building Tools

5 Example III: Insurance

Page 90: The Art of Building Tools

   

Insurance Workbench

More Form-Like Notation

This workbench is to be used by insurance experts

Page 91: The Art of Building Tools

   

Insurance Workbench

More Form-Like Notation

This workbench is to be used by insurance experts

Page 92: The Art of Building Tools

   

Insurance Workbench

More Form-Like Notation – with Expressions

Non-Programmers like Forms and Buttons – and need Lang‘s

Page 93: The Art of Building Tools

   

Insurance Workbench

Mathematical Notation

This workbench was used by insurance domain experts

Page 94: The Art of Building Tools

   

Insurance Workbench

Tables (taken from diff. Example)

A bit like „Excel“ with a real language behind it.

Page 95: The Art of Building Tools

   

Insurance Workbench

Tables (taken from diff. Example)

A bit like „Excel“ with a real language behind it.

Page 96: The Art of Building Tools

6 Summing up

Page 97: The Art of Building Tools

Summing Up

Key Points

To build meaningful tools, the data must be extended.

Extending the tool (buttons, views, ...) is not enough!

Page 98: The Art of Building Tools

Summing Up

Key Points

Structured Data can be expressed with languages.

Languages are data formats plus syntax and IDE.

Page 99: The Art of Building Tools

Summing Up

Key Points

Language Engineering supports extension and composition

This supports adapting tools for specific domains easily.

Page 100: The Art of Building Tools

Summing Up

Key Points

IDE-style tools are very good for editing data/programs.

We‘ve got a lot of experience from regular programming.

Page 101: The Art of Building Tools

Summing Up

Key Points

Language Workbenches are the key enabling technology.

MPS is IMHO the most power- ful, but it‘s not the only one!

Page 102: The Art of Building Tools

Summing Up

Key Points

Let‘s build new classes of tools!

... which make meaningful extensibility a reality!

Page 103: The Art of Building Tools

Ω The End.

Page 104: The Art of Building Tools

voelter.de dslbook.org mbeddr.com jetbrains.com/mps

The End.