Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DSL Design - Best Practices (XtextCON 2015)

DSL Design - Best Practices (XtextCON 2015)

Sven Efftinge

May 20, 2015
Tweet

More Decks by Sven Efftinge

Other Decks in Technology

Transcript

  1. Why an External DSL • Write the thing you care

    in the way you want • Have compile time feedback, that understand your domain • Be cross platform / platform independent
  2. A Good DSL makes editing simpler makes reading simpler improves

    stakeholder communication uses a familiar syntax nicely integrates into workflow tools and execution are fast is highly maintainable
  3. class { visibility=public name="HelloWorld" members = [ method { visibility=public

    static=true returnType=void name="main" parameters = [ parameter { type = String varArgs = true name = args } ] ... } ] } public class HelloWorld { public static void main(String... args) { System.out.println("Hello World"); } } Generic vs. 
 Specific
  4. Multiple Files FTW a package or namespace is a logical

    container but
 not necessarily a physical! improves collaboration
  5. Invasiveness • The outside view must only change 
 when

    the file changes physically • Bad Example: Xtend return types