SlideShare a Scribd company logo
1 of 50
Download to read offline
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-Speciļ¬c Languages




Problem
                   DSL                 HLL               Machine
Domain




      domain-speciļ¬c languages support more specialization
Domain-Speciļ¬c Languages

                Even Higher-
                   Level
                 Languages


Problem
                   DSL                 HLL               Machine
Domain




      domain-speciļ¬c languages support more specialization
Software Language Design & Engineering




enable software engineers to
effectively design, implement,
 and apply domain-speciļ¬c
     software languages
Research: Software Language Design


 Systematically design domain-
      speciļ¬c 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)
                        Ofļ¬‚ine support
      Canvas
                  Accelerator support
   Multi-touch
Native Applications


            Address book
                Camera
               Compass
                 File IO
             Notiļ¬cations
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 efļ¬cient,
scalable, incremental compiler +
   usable IDE from high-level,
   declarativelanguage
           deļ¬nition
The Spoofax Language Workbench




creating full featured IDEs for domain-speciļ¬c languages
The Spoofax Language Workbench




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




  Integrated Language Deļ¬nition Testing
Syntax Deļ¬nition

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 Deļ¬nition
                                             http://mobl-lang.org
 Static Analysis of Language Deļ¬nitions
                                                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

FP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondFP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyond
Mario Fusco
Ā 
Nik Graf - Get started with Reason and ReasonReact
Nik Graf - Get started with Reason and ReasonReactNik Graf - Get started with Reason and ReasonReact
Nik Graf - Get started with Reason and ReasonReact
OdessaJS Conf
Ā 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meet
Mario Fusco
Ā 
Micro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateMicro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicate
Kiev ALT.NET
Ā 

What's hot (18)

Joy of scala
Joy of scalaJoy of scala
Joy of scala
Ā 
Spring has got me under itā€™s SpEL
Spring has got me under itā€™s SpELSpring has got me under itā€™s SpEL
Spring has got me under itā€™s SpEL
Ā 
Contracts in-clojure-pete
Contracts in-clojure-peteContracts in-clojure-pete
Contracts in-clojure-pete
Ā 
FP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondFP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyond
Ā 
From java to kotlin beyond alt+shift+cmd+k - Droidcon italy
From java to kotlin beyond alt+shift+cmd+k - Droidcon italyFrom java to kotlin beyond alt+shift+cmd+k - Droidcon italy
From java to kotlin beyond alt+shift+cmd+k - Droidcon italy
Ā 
Nik Graf - Get started with Reason and ReasonReact
Nik Graf - Get started with Reason and ReasonReactNik Graf - Get started with Reason and ReasonReact
Nik Graf - Get started with Reason and ReasonReact
Ā 
Model-Driven Software Development - Pretty-Printing, Editor Services, Term Re...
Model-Driven Software Development - Pretty-Printing, Editor Services, Term Re...Model-Driven Software Development - Pretty-Printing, Editor Services, Term Re...
Model-Driven Software Development - Pretty-Printing, Editor Services, Term Re...
Ā 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meet
Ā 
Talk - Query monad
Talk - Query monad Talk - Query monad
Talk - Query monad
Ā 
Micro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateMicro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicate
Ā 
C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8
Ā 
Scala best practices
Scala best practicesScala best practices
Scala best practices
Ā 
Functional Principles for OO Developers
Functional Principles for OO DevelopersFunctional Principles for OO Developers
Functional Principles for OO Developers
Ā 
C# 7
C# 7C# 7
C# 7
Ā 
UKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the DatabaseUKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the Database
Ā 
Type safe embedded domain-specific languages
Type safe embedded domain-specific languagesType safe embedded domain-specific languages
Type safe embedded domain-specific languages
Ā 
Design Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesDesign Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on Examples
Ā 
R Programming: Learn To Manipulate Strings In R
R Programming: Learn To Manipulate Strings In RR Programming: Learn To Manipulate Strings In R
R Programming: Learn To Manipulate Strings In R
Ā 

Similar to Software Language Design & Engineering

mobl presentation @ IHomer
mobl presentation @ IHomermobl presentation @ IHomer
mobl presentation @ IHomer
zefhemel
Ā 
mobl - model-driven engineering lecture
mobl - model-driven engineering lecturemobl - model-driven engineering lecture
mobl - model-driven engineering lecture
zefhemel
Ā 
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseEclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
Heiko Behrens
Ā 
TI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific LanguagesTI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific Languages
Eelco Visser
Ā 
mobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkeling
Devnology
Ā 

Similar to Software Language Design & Engineering (20)

Software Language Design & Engineering: Mobl & Spoofax
Software Language Design & Engineering: Mobl & SpoofaxSoftware Language Design & Engineering: Mobl & Spoofax
Software Language Design & Engineering: Mobl & Spoofax
Ā 
Linguistic Abstraction for the Web
Linguistic Abstraction for the WebLinguistic Abstraction for the Web
Linguistic Abstraction for the Web
Ā 
mobl presentation @ IHomer
mobl presentation @ IHomermobl presentation @ IHomer
mobl presentation @ IHomer
Ā 
mobl - model-driven engineering lecture
mobl - model-driven engineering lecturemobl - model-driven engineering lecture
mobl - model-driven engineering lecture
Ā 
mobl
moblmobl
mobl
Ā 
IN4308 Lecture 3
IN4308 Lecture 3IN4308 Lecture 3
IN4308 Lecture 3
Ā 
mobl
moblmobl
mobl
Ā 
Html5 For Jjugccc2009fall
Html5 For Jjugccc2009fallHtml5 For Jjugccc2009fall
Html5 For Jjugccc2009fall
Ā 
Microsoft 2014 Dev Plataform - Roslyn -& ASP.NET vNext
Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNextMicrosoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext
Microsoft 2014 Dev Plataform - Roslyn -& ASP.NET vNext
Ā 
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseEclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
Ā 
2008 - TechDays PT: WCF, JSON and AJAX for performance and manageability
2008 - TechDays PT: WCF, JSON and AJAX for performance and manageability2008 - TechDays PT: WCF, JSON and AJAX for performance and manageability
2008 - TechDays PT: WCF, JSON and AJAX for performance and manageability
Ā 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
Ā 
Paris js extensions
Paris js extensionsParis js extensions
Paris js extensions
Ā 
TI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific LanguagesTI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific Languages
Ā 
mobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkeling
Ā 
Tml for Objective C
Tml for Objective CTml for Objective C
Tml for Objective C
Ā 
Gwt and Xtend
Gwt and XtendGwt and Xtend
Gwt and Xtend
Ā 
Html5 and web technology update
Html5 and web technology updateHtml5 and web technology update
Html5 and web technology update
Ā 
5 x HTML5 worth using in APEX (5)
5 x HTML5 worth using in APEX (5)5 x HTML5 worth using in APEX (5)
5 x HTML5 worth using in APEX (5)
Ā 
Building DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language WorkbenchBuilding DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language Workbench
Ā 

More from Eelco Visser

Declarative Type System Specification with Statix
Declarative Type System Specification with StatixDeclarative Type System Specification with Statix
Declarative Type System Specification with Statix
Eelco Visser
Ā 

More from Eelco Visser (20)

CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term RewritingCS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
Ā 
CS4200 2019 | Lecture 4 | Syntactic Services
CS4200 2019 | Lecture 4 | Syntactic ServicesCS4200 2019 | Lecture 4 | Syntactic Services
CS4200 2019 | Lecture 4 | Syntactic Services
Ā 
CS4200 2019 | Lecture 3 | Parsing
CS4200 2019 | Lecture 3 | ParsingCS4200 2019 | Lecture 3 | Parsing
CS4200 2019 | Lecture 3 | Parsing
Ā 
CS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definitionCS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definition
Ā 
CS4200 2019 Lecture 1: Introduction
CS4200 2019 Lecture 1: IntroductionCS4200 2019 Lecture 1: Introduction
CS4200 2019 Lecture 1: Introduction
Ā 
A Direct Semantics of Declarative Disambiguation Rules
A Direct Semantics of Declarative Disambiguation RulesA Direct Semantics of Declarative Disambiguation Rules
A Direct Semantics of Declarative Disambiguation Rules
Ā 
Declarative Type System Specification with Statix
Declarative Type System Specification with StatixDeclarative Type System Specification with Statix
Declarative Type System Specification with Statix
Ā 
Compiler Construction | Lecture 17 | Beyond Compiler Construction
Compiler Construction | Lecture 17 | Beyond Compiler ConstructionCompiler Construction | Lecture 17 | Beyond Compiler Construction
Compiler Construction | Lecture 17 | Beyond Compiler Construction
Ā 
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Ā 
Compiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory ManagementCompiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory Management
Ā 
Compiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | InterpretersCompiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | Interpreters
Ā 
Compiler Construction | Lecture 13 | Code Generation
Compiler Construction | Lecture 13 | Code GenerationCompiler Construction | Lecture 13 | Code Generation
Compiler Construction | Lecture 13 | Code Generation
Ā 
Compiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual MachinesCompiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual Machines
Ā 
Compiler Construction | Lecture 11 | Monotone Frameworks
Compiler Construction | Lecture 11 | Monotone FrameworksCompiler Construction | Lecture 11 | Monotone Frameworks
Compiler Construction | Lecture 11 | Monotone Frameworks
Ā 
Compiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisCompiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow Analysis
Ā 
Compiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint ResolutionCompiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint Resolution
Ā 
Compiler Construction | Lecture 8 | Type Constraints
Compiler Construction | Lecture 8 | Type ConstraintsCompiler Construction | Lecture 8 | Type Constraints
Compiler Construction | Lecture 8 | Type Constraints
Ā 
Compiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingCompiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type Checking
Ā 
Compiler Construction | Lecture 6 | Introduction to Static Analysis
Compiler Construction | Lecture 6 | Introduction to Static AnalysisCompiler Construction | Lecture 6 | Introduction to Static Analysis
Compiler Construction | Lecture 6 | Introduction to Static Analysis
Ā 
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term RewritingCompiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Ā 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
Ā 

Recently uploaded (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
Ā 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Ā 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
Ā 
šŸ¬ The future of MySQL is Postgres šŸ˜
šŸ¬  The future of MySQL is Postgres   šŸ˜šŸ¬  The future of MySQL is Postgres   šŸ˜
šŸ¬ The future of MySQL is Postgres šŸ˜
Ā 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Ā 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Ā 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Ā 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Ā 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Ā 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Ā 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Ā 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Ā 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
Ā 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Ā 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Ā 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Ā 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
Ā 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
Ā 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
Ā 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
Ā 

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-Speciļ¬c Languages Problem DSL HLL Machine Domain domain-speciļ¬c languages support more specialization
  • 5. Domain-Speciļ¬c Languages Even Higher- Level Languages Problem DSL HLL Machine Domain domain-speciļ¬c languages support more specialization
  • 6. Software Language Design & Engineering enable software engineers to effectively design, implement, and apply domain-speciļ¬c software languages
  • 7. Research: Software Language Design Systematically design domain- speciļ¬c 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) Ofļ¬‚ine support Canvas Accelerator support Multi-touch
  • 16. Native Applications Address book Camera Compass File IO Notiļ¬cations
  • 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 efļ¬cient, scalable, incremental compiler + usable IDE from high-level, declarativelanguage deļ¬nition
  • 44. The Spoofax Language Workbench creating full featured IDEs for domain-speciļ¬c languages
  • 45. The Spoofax Language Workbench an IDE for developing languages and their IDEs
  • 46. The Spoofax Language Workbench Integrated Language Deļ¬nition Testing
  • 47. Syntax Deļ¬nition 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 Deļ¬nition http://mobl-lang.org Static Analysis of Language Deļ¬nitions http://webdsl.org Language Workbench in the Cloud http://researchr.org http://researchr.org/search/publication/mobl+spoofax+webdsl