SlideShare a Scribd company logo
Software Language
Design & Engineering

       Eelco Visser
      http://eelcovisser.org




                               Zürich, May 12, 2011
Software Engineering




Problem
                                                         Machine
Domain




   bridging the gap between problem domain and solution domain
High-Level Languages




Problem
                           HLL   Machine
Domain




             HLLs reduce gap
Domain-Specific Languages




Problem
                   DSL                 HLL               Machine
Domain




      domain-specific languages support more specialization
Domain-Specific Languages

                Even Higher-
                   Level
                 Languages


Problem
                   DSL                 HLL               Machine
Domain




      domain-specific languages support more specialization
Software Language Design & Engineering




enable software engineers to
effectively design, implement,
 and apply domain-specific
     software languages
Research: Software Language Design


 Systematically design domain-
      specific software
  languages with optimal
   tradeoff between expressivity,
completeness, portability, coverage, and
           maintainability
Expressivity vs Coverage




expressivity: fewer irrelevant details => conciseness
coverage: which portion of domain can we express
Software Language Design Case Studies



                                               Mobl: client-side stateful web applications




WebDSL: server-side restful web applications
http://www.mobl-lang.org

Zef Hemel
Divergence in Mobile Platforms




 Objective-C            Java                  J2ME/C++




HTML/Javascript         Java                    .NET

           Native Applications not Portable
Convergence in Mobile Platform




Webkit browser   Webkit browser




Webkit browser   Webkit browser
The Universal Userinterface Engine
Mobile Web Architecture
Rich Applications

                                 Audio
 WebDatabases
                  Full-screen support
Location information
       (GPS)
                        Offline support
      Canvas
                  Accelerator support
   Multi-touch
Native Applications


            Address book
                Camera
               Compass
                 File IO
             Notifications
Software Engineering with JavaScript




annotated HTML                imperative Javascript

 MVC, No Integration, No Abstraction, Accidental Complexity
typed        declarative




integrated      concise
Web Application with Touch
Portable Applications
Mobl Architecture
tipcalculator.mobl


application tipcalculator

import mobl::ui::generic

screen root() {
  var amount = 20
  var percentage = 10
  header("Tip calculator")
  group {
    item { numField(amount, label="amount") }
    item { numField(percentage, label="percentage") }
    item { "$" label(Math.round(amount * (1 + percentage/100))) }
  }
  nl()
}
Model-View Pattern
Task Manager
Data Model

entity Task {
  name : String (searchable)
  done : Bool
  due : DateTime
  category : Category (inverse: tasks)
  tags : Collection<Tag> (inverse: tasks)
}
entity Category {
  name : String
  tasks : Collection<Task> (inverse: category)
}
entity Tag {
  name : String
  tasks : Collection<Task> (inverse: tags)
}




           HTML5 Data Persistence
Logic
entity Task {
  name : String (searchable)
  done : Bool
  due : DateTime
  category : Category (inverse: tasks)
  tags : Collection<Tag> (inverse: tasks)
  function postpone(days : Num) {
    this.due = DateTime.create(
      this.due.getFullYear(),
      this.due.getMonth(),
      this.due.getDate() + days);
  }
  function import(user : String, pw : String) {
    var tasksJSON = httpRequest("/export?user="+ user + "&pw=" + pw);
    foreach(t in tasksJSON) {
      add(Task.fromSelectJSON(t));
    }
  }
}




                 statically typed: catch errors early
Reactive User Interfaces

screen root() {
  var phrase = ""
  header("Tasks") {
    button("Add", onclick={ addTask(); })
  }
  searchBox(phrase)
  group {
    list(t in Task.search(phrase) limit 20){
      item {
        checkBox(t.done, label=t.name)
      }
    }
  }
}
Reactive User Interfaces

screen root() {
  var phrase = ""
  header("Tasks") {
    button("Add", onclick={ addTask(); })
  }
  searchBox(phrase)
  group {
    list(t in Task.search(phrase) limit 20){
      item {
        checkBox(t.done, label=t.name)
      }
    }
  }
}
Navigation

screen root() {
  var phrase = ""
  header("Tasks") {
    button("Add", onclick={ addTask(); })
  }
  searchBox(phrase)
  group {
    list(t in Task.search(phrase) limit 20){
      item {
        checkBox(t.done, label=t.name)
      }
    }
  }
}
Navigation

screen root() { {
         addTask()
  var phrase = ""
       t = Task()
  header("Add") {
  header("Tasks") {
    button("Done", onclick={
    button("Add", onclick={ addTask(); })
  }    add(t);
  searchBox(phrase)
       screen return;
  group {
    })
  } list(t in Task.search(phrase) limit 20){
  textField(t.name)
       item {
  datePicker(t.due)
          checkBox(t.done, label=t.name)
}      }
    }
  }
}
Navigation

screen root() {
  var phrase = ""
  header("Tasks") {
    button("Add", onclick={ addTask(); })
  }
  searchBox(phrase)
  group {
    list(t in Task.search(phrase) limit 20){
      item {
        checkBox(t.done, label=t.name)
      }
    }
  }
}
Continuations

screen root() {
  button("Ask", onclick={
     alert("Hello " + prompt("First name") + " "
                     + prompt("Last name"));
  })
}
screen prompt(question : String) : String {
  var answer = ""
  header(question) {
     button("Done", onclick={
        screen return answer;
     })
  }
  textField(answer)
}
User Interface Idiom: Tab



control tab1() {
  header("Tab 1")
  label("This is tab 1")
}
control tab2() {
  header("Tab 2")
  label("This is tab 2")
}
screen root() {
  tabSet([("One", tab1), ("Two", tab2)],
  defaultTab="One")
}
Tab Set: Higher-Order Control


control tabSet(tabs : [(String,Control)], activeTab : String) {
  list((tabName, tabControl) in tabs) {
    block(onclick={ activeTab = tabName; },
          style=activeTab==tabName ?
                activeTabButton : inactiveTabButton) {
      label(tabName)
    }
  }
  list((tabName, tabControl) in tabs) {
    block(activeTab==tabName ? visibleTab : invisibleTab) {
      tabControl()
    }
  }
}




  increase coverage: developers can create abstractions
User Interface Idiom: Master Detail



control taskItem(t : Task) {
  checkBox(t.done, label=t.name)
}
control taskDetail(t : Task) {
  textField(t.name)
  datePicker(t.due)
}
screen root() {
  header("Tasks")
  masterDetail(Task.all() order by due desc,
  taskItem, taskDetail)
}
User Interface Idiom: Master Detail



control taskItem(t : Task) {
  checkBox(t.done, label=t.name)
}
control taskDetail(t : Task) {
  textField(t.name)
  datePicker(t.due)
}
screen root() {
  header("Tasks")
  masterDetail(Task.all() order by due desc,
  taskItem, taskDetail)
}
Master Detail: Higher-Order Control


control masterDetail(items : Collection<?>, masterItem : Control1<?>,
detail : Control1<?>) {
  group {
    list(it in items) {
      item(onclick={ detailScreen(it,detail); }) {
        masterItem(it)
      }
    }
  }
}
screen detailScreen(it : ?, detail : Control1<?>) {
  header("Detail") { backButton() }
  detail(it)
}
Mobl Applications
GR8 Conference Program
mPodder
Ken




http://itsneh.com/ken/
Mobl IDE




static cross-concern consistency checking
Research: Software Language Engineering



 Automatically derive efficient,
scalable, incremental compiler +
   usable IDE from high-level,
   declarativelanguage
           definition
The Spoofax Language Workbench




creating full featured IDEs for domain-specific languages
The Spoofax Language Workbench




an IDE for developing languages and their IDEs
The Spoofax Language Workbench




  Integrated Language Definition Testing
Syntax Definition

module MoBL-Data

imports
  Common
  MoBL

exports
  context-free syntax
    MetaAnno* "entity" QId ":" Type "{" Property* "}" -> Definition {cons("Entity")}
    MetaAnno* "entity" QId "{" Property* "}" -> Definition {cons("EntityNoSuper")}
    MetaAnno* ID ":" Type "(" {Anno ","}* ")" -> Property {cons("Property")}
    MetaAnno* ID ":" Type                     -> Property {cons("PropertyNoAnnos")}
    ID                              -> Anno {cons("SimpleAnno")}
    "inverse" ":" ID                -> Anno {cons("InverseAnno")}

  context-free syntax
    "@sync" UriPath -> MetaAnno {cons("SyncEntityAnno")}
Type Checking



rules

  constraint-error :
    t@SimpleType(_) -> (t, $[Type is not defined: [<pp-mobl-type> t]])
    where not(<lookup-type> t)

  constraint-error :
    t@FieldAccess(e, x) -> (t, $[Property [x] not defined])
    where <type-of> e
    where not(type-of)
Code Generation



rules

  property-to-js(|ent) :
    Property(_, x, t@SimpleType(_), anno*) -> $['[x]': '[sqlType]']
    where not(<is-entity-type> t)
    with sqlType := <sql-type> t
       ; if [_] := <filter(?SimpleAnno("searchable"))> anno* then
           rules ( SearchableProperties :+= (ent, x) )
         end
Software Language Design & Engineering



                                            http://eelcovisser.org
Language Design as Engineering Discipline
                                               http://spoofax.org
 (More) Declarative Language Definition
                                             http://mobl-lang.org
 Static Analysis of Language Definitions
                                                http://webdsl.org
   Language Workbench in the Cloud

                                             http://researchr.org



http://researchr.org/search/publication/mobl+spoofax+webdsl

More Related Content

What's hot (18)

PPTX
Joy of scala
Maxim Novak
 
PPSX
Spring has got me under it’s SpEL
Eldad Dor
 
PDF
Contracts in-clojure-pete
jessitron
 
PDF
FP in Java - Project Lambda and beyond
Mario Fusco
 
PDF
From java to kotlin beyond alt+shift+cmd+k - Droidcon italy
Fabio Collini
 
PDF
Nik Graf - Get started with Reason and ReasonReact
OdessaJS Conf
 
PDF
Model-Driven Software Development - Pretty-Printing, Editor Services, Term Re...
Eelco Visser
 
PPTX
Scala - where objects and functions meet
Mario Fusco
 
PDF
Talk - Query monad
Fabernovel
 
PPT
Micro-ORM Introduction - Don't overcomplicate
Kiev ALT.NET
 
PDF
C# 7.x What's new and what's coming with C# 8
Christian Nagel
 
PPTX
Scala best practices
Alexander Zaidel
 
PDF
Functional Principles for OO Developers
jessitron
 
PDF
C# 7
Mike Harris
 
PDF
UKOUG Tech14 - Getting Started With JSON in the Database
Marco Gralike
 
PDF
Type safe embedded domain-specific languages
Arthur Xavier
 
PDF
Design Patterns - Compiler Case Study - Hands-on Examples
Ganesh Samarthyam
 
PDF
R Programming: Learn To Manipulate Strings In R
Rsquared Academy
 
Joy of scala
Maxim Novak
 
Spring has got me under it’s SpEL
Eldad Dor
 
Contracts in-clojure-pete
jessitron
 
FP in Java - Project Lambda and beyond
Mario Fusco
 
From java to kotlin beyond alt+shift+cmd+k - Droidcon italy
Fabio Collini
 
Nik Graf - Get started with Reason and ReasonReact
OdessaJS Conf
 
Model-Driven Software Development - Pretty-Printing, Editor Services, Term Re...
Eelco Visser
 
Scala - where objects and functions meet
Mario Fusco
 
Talk - Query monad
Fabernovel
 
Micro-ORM Introduction - Don't overcomplicate
Kiev ALT.NET
 
C# 7.x What's new and what's coming with C# 8
Christian Nagel
 
Scala best practices
Alexander Zaidel
 
Functional Principles for OO Developers
jessitron
 
UKOUG Tech14 - Getting Started With JSON in the Database
Marco Gralike
 
Type safe embedded domain-specific languages
Arthur Xavier
 
Design Patterns - Compiler Case Study - Hands-on Examples
Ganesh Samarthyam
 
R Programming: Learn To Manipulate Strings In R
Rsquared Academy
 

Similar to Software Language Design & Engineering (20)

PDF
Software Language Design & Engineering: Mobl & Spoofax
Eelco Visser
 
PDF
Linguistic Abstraction for the Web
Eelco Visser
 
PDF
mobl: Een DSL voor mobiele applicatieontwikkeling
Devnology
 
PDF
mobl presentation @ IHomer
zefhemel
 
PDF
mobl - model-driven engineering lecture
zefhemel
 
PDF
Building DSLs with the Spoofax Language Workbench
Eelco Visser
 
PDF
mobl
Eelco Visser
 
PPT
Trends in Programming Technology you might want to keep an eye on af Bent Tho...
InfinIT - Innovationsnetværket for it
 
ZIP
Separation of Concerns in Web User Interfaces
jippeh
 
PDF
Functional solid
Matt Stine
 
PPT
Understanding Framework Architecture using Eclipse
anshunjain
 
PDF
Architecting non-trivial browser applications (Jazoon 2012)
Marc Bächinger
 
PDF
Programming Languages: some news for the last N years
Ruslan Shevchenko
 
PDF
IN4308 Lecture 3
Eelco Visser
 
PDF
mobl
zefhemel
 
PDF
Model2Roo - ACME
jccastrejon
 
PDF
TI1220 Lecture 14: Domain-Specific Languages
Eelco Visser
 
PPTX
OOP, API Design and MVP
Harshith Keni
 
PPTX
Solid OOPS
Toshish Jawale
 
PDF
Interacting Domain Specific Languages
Sander Mak (@Sander_Mak)
 
Software Language Design & Engineering: Mobl & Spoofax
Eelco Visser
 
Linguistic Abstraction for the Web
Eelco Visser
 
mobl: Een DSL voor mobiele applicatieontwikkeling
Devnology
 
mobl presentation @ IHomer
zefhemel
 
mobl - model-driven engineering lecture
zefhemel
 
Building DSLs with the Spoofax Language Workbench
Eelco Visser
 
Trends in Programming Technology you might want to keep an eye on af Bent Tho...
InfinIT - Innovationsnetværket for it
 
Separation of Concerns in Web User Interfaces
jippeh
 
Functional solid
Matt Stine
 
Understanding Framework Architecture using Eclipse
anshunjain
 
Architecting non-trivial browser applications (Jazoon 2012)
Marc Bächinger
 
Programming Languages: some news for the last N years
Ruslan Shevchenko
 
IN4308 Lecture 3
Eelco Visser
 
mobl
zefhemel
 
Model2Roo - ACME
jccastrejon
 
TI1220 Lecture 14: Domain-Specific Languages
Eelco Visser
 
OOP, API Design and MVP
Harshith Keni
 
Solid OOPS
Toshish Jawale
 
Interacting Domain Specific Languages
Sander Mak (@Sander_Mak)
 
Ad

More from Eelco Visser (20)

PDF
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
Eelco Visser
 
PDF
CS4200 2019 | Lecture 4 | Syntactic Services
Eelco Visser
 
PDF
CS4200 2019 | Lecture 3 | Parsing
Eelco Visser
 
PDF
CS4200 2019 | Lecture 2 | syntax-definition
Eelco Visser
 
PDF
CS4200 2019 Lecture 1: Introduction
Eelco Visser
 
PDF
A Direct Semantics of Declarative Disambiguation Rules
Eelco Visser
 
PDF
Declarative Type System Specification with Statix
Eelco Visser
 
PDF
Compiler Construction | Lecture 17 | Beyond Compiler Construction
Eelco Visser
 
PDF
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Eelco Visser
 
PDF
Compiler Construction | Lecture 15 | Memory Management
Eelco Visser
 
PDF
Compiler Construction | Lecture 14 | Interpreters
Eelco Visser
 
PDF
Compiler Construction | Lecture 13 | Code Generation
Eelco Visser
 
PDF
Compiler Construction | Lecture 12 | Virtual Machines
Eelco Visser
 
PDF
Compiler Construction | Lecture 11 | Monotone Frameworks
Eelco Visser
 
PDF
Compiler Construction | Lecture 10 | Data-Flow Analysis
Eelco Visser
 
PDF
Compiler Construction | Lecture 9 | Constraint Resolution
Eelco Visser
 
PDF
Compiler Construction | Lecture 8 | Type Constraints
Eelco Visser
 
PDF
Compiler Construction | Lecture 7 | Type Checking
Eelco Visser
 
PDF
Compiler Construction | Lecture 6 | Introduction to Static Analysis
Eelco Visser
 
PDF
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Eelco Visser
 
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
Eelco Visser
 
CS4200 2019 | Lecture 4 | Syntactic Services
Eelco Visser
 
CS4200 2019 | Lecture 3 | Parsing
Eelco Visser
 
CS4200 2019 | Lecture 2 | syntax-definition
Eelco Visser
 
CS4200 2019 Lecture 1: Introduction
Eelco Visser
 
A Direct Semantics of Declarative Disambiguation Rules
Eelco Visser
 
Declarative Type System Specification with Statix
Eelco Visser
 
Compiler Construction | Lecture 17 | Beyond Compiler Construction
Eelco Visser
 
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Eelco Visser
 
Compiler Construction | Lecture 15 | Memory Management
Eelco Visser
 
Compiler Construction | Lecture 14 | Interpreters
Eelco Visser
 
Compiler Construction | Lecture 13 | Code Generation
Eelco Visser
 
Compiler Construction | Lecture 12 | Virtual Machines
Eelco Visser
 
Compiler Construction | Lecture 11 | Monotone Frameworks
Eelco Visser
 
Compiler Construction | Lecture 10 | Data-Flow Analysis
Eelco Visser
 
Compiler Construction | Lecture 9 | Constraint Resolution
Eelco Visser
 
Compiler Construction | Lecture 8 | Type Constraints
Eelco Visser
 
Compiler Construction | Lecture 7 | Type Checking
Eelco Visser
 
Compiler Construction | Lecture 6 | Introduction to Static Analysis
Eelco Visser
 
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Eelco Visser
 
Ad

Recently uploaded (20)

PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PPTX
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
 
PDF
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
PDF
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
 
PPTX
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
PDF
Proactive Server and System Monitoring with FME: Using HTTP and System Caller...
Safe Software
 
PDF
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
PDF
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
PDF
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
PDF
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PPTX
Wondershare Filmora Crack Free Download 2025
josanj305
 
PDF
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
PDF
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
PPTX
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
PDF
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
WSO2
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
Why aren't you using FME Flow's CPU Time?
Safe Software
 
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
 
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
Proactive Server and System Monitoring with FME: Using HTTP and System Caller...
Safe Software
 
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
Wondershare Filmora Crack Free Download 2025
josanj305
 
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
WSO2
 

Software Language Design & Engineering

  • 1. Software Language Design & Engineering Eelco Visser http://eelcovisser.org Zürich, May 12, 2011
  • 2. Software Engineering Problem Machine Domain bridging the gap between problem domain and solution domain
  • 3. High-Level Languages Problem HLL Machine Domain HLLs reduce gap
  • 4. Domain-Specific Languages Problem DSL HLL Machine Domain domain-specific languages support more specialization
  • 5. Domain-Specific Languages Even Higher- Level Languages Problem DSL HLL Machine Domain domain-specific languages support more specialization
  • 6. Software Language Design & Engineering enable software engineers to effectively design, implement, and apply domain-specific software languages
  • 7. Research: Software Language Design Systematically design domain- specific software languages with optimal tradeoff between expressivity, completeness, portability, coverage, and maintainability
  • 8. Expressivity vs Coverage expressivity: fewer irrelevant details => conciseness coverage: which portion of domain can we express
  • 9. Software Language Design Case Studies Mobl: client-side stateful web applications WebDSL: server-side restful web applications
  • 11. Divergence in Mobile Platforms Objective-C Java J2ME/C++ HTML/Javascript Java .NET Native Applications not Portable
  • 12. Convergence in Mobile Platform Webkit browser Webkit browser Webkit browser Webkit browser
  • 15. Rich Applications Audio WebDatabases Full-screen support Location information (GPS) Offline support Canvas Accelerator support Multi-touch
  • 16. Native Applications Address book Camera Compass File IO Notifications
  • 17. Software Engineering with JavaScript annotated HTML imperative Javascript MVC, No Integration, No Abstraction, Accidental Complexity
  • 18. typed declarative integrated concise
  • 22. tipcalculator.mobl application tipcalculator import mobl::ui::generic screen root() { var amount = 20 var percentage = 10 header("Tip calculator") group { item { numField(amount, label="amount") } item { numField(percentage, label="percentage") } item { "$" label(Math.round(amount * (1 + percentage/100))) } } nl() }
  • 25. Data Model entity Task { name : String (searchable) done : Bool due : DateTime category : Category (inverse: tasks) tags : Collection<Tag> (inverse: tasks) } entity Category { name : String tasks : Collection<Task> (inverse: category) } entity Tag { name : String tasks : Collection<Task> (inverse: tags) } HTML5 Data Persistence
  • 26. Logic entity Task { name : String (searchable) done : Bool due : DateTime category : Category (inverse: tasks) tags : Collection<Tag> (inverse: tasks) function postpone(days : Num) { this.due = DateTime.create( this.due.getFullYear(), this.due.getMonth(), this.due.getDate() + days); } function import(user : String, pw : String) { var tasksJSON = httpRequest("/export?user="+ user + "&pw=" + pw); foreach(t in tasksJSON) { add(Task.fromSelectJSON(t)); } } } statically typed: catch errors early
  • 27. Reactive User Interfaces screen root() { var phrase = "" header("Tasks") { button("Add", onclick={ addTask(); }) } searchBox(phrase) group { list(t in Task.search(phrase) limit 20){ item { checkBox(t.done, label=t.name) } } } }
  • 28. Reactive User Interfaces screen root() { var phrase = "" header("Tasks") { button("Add", onclick={ addTask(); }) } searchBox(phrase) group { list(t in Task.search(phrase) limit 20){ item { checkBox(t.done, label=t.name) } } } }
  • 29. Navigation screen root() { var phrase = "" header("Tasks") { button("Add", onclick={ addTask(); }) } searchBox(phrase) group { list(t in Task.search(phrase) limit 20){ item { checkBox(t.done, label=t.name) } } } }
  • 30. Navigation screen root() { { addTask() var phrase = "" t = Task() header("Add") { header("Tasks") { button("Done", onclick={ button("Add", onclick={ addTask(); }) } add(t); searchBox(phrase) screen return; group { }) } list(t in Task.search(phrase) limit 20){ textField(t.name) item { datePicker(t.due) checkBox(t.done, label=t.name) } } } } }
  • 31. Navigation screen root() { var phrase = "" header("Tasks") { button("Add", onclick={ addTask(); }) } searchBox(phrase) group { list(t in Task.search(phrase) limit 20){ item { checkBox(t.done, label=t.name) } } } }
  • 32. Continuations screen root() { button("Ask", onclick={ alert("Hello " + prompt("First name") + " " + prompt("Last name")); }) } screen prompt(question : String) : String { var answer = "" header(question) { button("Done", onclick={ screen return answer; }) } textField(answer) }
  • 33. User Interface Idiom: Tab control tab1() { header("Tab 1") label("This is tab 1") } control tab2() { header("Tab 2") label("This is tab 2") } screen root() { tabSet([("One", tab1), ("Two", tab2)], defaultTab="One") }
  • 34. Tab Set: Higher-Order Control control tabSet(tabs : [(String,Control)], activeTab : String) { list((tabName, tabControl) in tabs) { block(onclick={ activeTab = tabName; }, style=activeTab==tabName ? activeTabButton : inactiveTabButton) { label(tabName) } } list((tabName, tabControl) in tabs) { block(activeTab==tabName ? visibleTab : invisibleTab) { tabControl() } } } increase coverage: developers can create abstractions
  • 35. User Interface Idiom: Master Detail control taskItem(t : Task) { checkBox(t.done, label=t.name) } control taskDetail(t : Task) { textField(t.name) datePicker(t.due) } screen root() { header("Tasks") masterDetail(Task.all() order by due desc, taskItem, taskDetail) }
  • 36. User Interface Idiom: Master Detail control taskItem(t : Task) { checkBox(t.done, label=t.name) } control taskDetail(t : Task) { textField(t.name) datePicker(t.due) } screen root() { header("Tasks") masterDetail(Task.all() order by due desc, taskItem, taskDetail) }
  • 37. Master Detail: Higher-Order Control control masterDetail(items : Collection<?>, masterItem : Control1<?>, detail : Control1<?>) { group { list(it in items) { item(onclick={ detailScreen(it,detail); }) { masterItem(it) } } } } screen detailScreen(it : ?, detail : Control1<?>) { header("Detail") { backButton() } detail(it) }
  • 42. Mobl IDE static cross-concern consistency checking
  • 43. Research: Software Language Engineering Automatically derive efficient, scalable, incremental compiler + usable IDE from high-level, declarativelanguage definition
  • 44. The Spoofax Language Workbench creating full featured IDEs for domain-specific languages
  • 45. The Spoofax Language Workbench an IDE for developing languages and their IDEs
  • 46. The Spoofax Language Workbench Integrated Language Definition Testing
  • 47. Syntax Definition module MoBL-Data imports Common MoBL exports context-free syntax MetaAnno* "entity" QId ":" Type "{" Property* "}" -> Definition {cons("Entity")} MetaAnno* "entity" QId "{" Property* "}" -> Definition {cons("EntityNoSuper")} MetaAnno* ID ":" Type "(" {Anno ","}* ")" -> Property {cons("Property")} MetaAnno* ID ":" Type -> Property {cons("PropertyNoAnnos")} ID -> Anno {cons("SimpleAnno")} "inverse" ":" ID -> Anno {cons("InverseAnno")} context-free syntax "@sync" UriPath -> MetaAnno {cons("SyncEntityAnno")}
  • 48. Type Checking rules constraint-error : t@SimpleType(_) -> (t, $[Type is not defined: [<pp-mobl-type> t]]) where not(<lookup-type> t) constraint-error : t@FieldAccess(e, x) -> (t, $[Property [x] not defined]) where <type-of> e where not(type-of)
  • 49. Code Generation rules property-to-js(|ent) : Property(_, x, t@SimpleType(_), anno*) -> $['[x]': '[sqlType]'] where not(<is-entity-type> t) with sqlType := <sql-type> t ; if [_] := <filter(?SimpleAnno("searchable"))> anno* then rules ( SearchableProperties :+= (ent, x) ) end
  • 50. Software Language Design & Engineering http://eelcovisser.org Language Design as Engineering Discipline http://spoofax.org (More) Declarative Language Definition http://mobl-lang.org Static Analysis of Language Definitions http://webdsl.org Language Workbench in the Cloud http://researchr.org http://researchr.org/search/publication/mobl+spoofax+webdsl