• Save
Composing Domain-Specific Languages
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Composing Domain-Specific Languages

  • 3,953 views
Uploaded on

The history of programming languages shows a progressive development from low-level programming languages close to the machine, to high-level languages close to the problems being solved with......

The history of programming languages shows a progressive development from low-level programming languages close to the machine, to high-level languages close to the problems being solved with software. Domain-specific languages take this a step further than general purpose programming languages by making assumptions about the class of applications for which the language is intended. Complete applications typically require programs in multiple (technical) domains, which can be catered for by separate domain-specific languages. While such separation of concerns is beneficial for domain expressivity, it often leads to loose coupling and lack of static verification. Hence, the design of individual DSLs needs to be complemented with their linguistic integration.

In this talk, I illustrate these ideas with the design of WebDSL, a domain-specific language for data centric web applications. WebDSL linguistically integrates the definition of data models, user interfaces, actions, access control rules, data validation rules, styling rules, and workflow definitions. While maintaining separation between these concerns through specialized sub-languages, linguistic integration ensures static consistency checking and correct code generation. The language allows developers to concentrate on the essential design of web applications, abstracting from accidental complexity, such as the details of data persistence. The combination of high-level and low-level constructs ensures high expressivity, while supporting customization to application requirements.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,953
On Slideshare
3,663
From Embeds
290
Number of Embeds
7

Actions

Shares
Downloads
0
Comments
0
Likes
8

Embeds 290

http://blog.eelcovisser.net 192
http://eelcovisser.org 52
http://www.slideshare.net 31
http://marwaninaltum.blogspot.com 11
http://theintelligententerprise.blogspot.ro 2
http://localhost:8080 1
http://theintelligententerprise.blogspot.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Composing Domain-Specific Languages Eelco Visser Delft University of Technology http://eelcovisser.org 12/11/2009 Technical University Eindhoven
  • 2. Software Engineering implement Problem Solution Domain Domain validate
  • 3. Programming Languages
  • 4. Abstraction Scala Programming Languages machine
  • 5. Abstraction Scala garbage collection objects Programming Languages expressions structured control-flow procedures machine
  • 6. Problem GPL Machine Domain
  • 7. The Next Level of Abstraction? Formal Methods
  • 8. Spec Problem GPL Machine Domain
  • 9. Spec Problem GPL Machine Domain
  • 10. The Next Level of Abstraction? Domain-Specific Languages
  • 11. The Next Level of Abstraction? SQL Domain-Specific Languages CFG (BNF) RegExp
  • 12. Problem DSL GPL Machine Domain Domain-Specific Languages: Specialization
  • 13. Software System Composition of Specialized Sub-domains
  • 14. Software System Separation of Concerns Composition of Specialized Sub-domains
  • 15. Loose Coupling Lack of consistency checks
  • 16. Thesis Separation of Concerns requires Linguistic Integration
  • 17. Case Study World Wide Web
  • 18. where does that link point? is that URL unique? who may edit this entry? where is data stored?
  • 19. request Client Server response Architecture
  • 20. quest Convert Request Access Control Validate Forms Parameters Render Page Or Handle Actions Redirect ponse Update Database
  • 21. Access Data Navigation quest Convert Request Control Validation Access Control Validate Forms Parameters Forms Data Model Actions Render Page Or Handle Actions Redirect ponse Object Page Data Binding Relational Templates Mapping Update Database
  • 22. Access Data Navigation Control Validation Forms Data Model Actions Object Page Data Binding Relational Templates Mapping (Some) Concerns in Web Applications
  • 23. Access Data Navigation Control Validation Data Forms Actions Model Object Page Data Relational Templates Binding Mapping data model entity class classes orm JPA active record actions Java/Seam Ruby data validation navigation servlets controllers page templates JavaServer Faces forms JSF tags embedded html data binding JSF + Seam access control Acegi
  • 24. Access Data Navigation Control Validation Data Forms Actions Model Object Page Data Relational Templates Binding Mapping <s:link view="/entry.xhtml" value="#{entry.title}" propagation="none"> <f:param name="entry" value="#{entry.id}"/> </s:link> @Name("entry") public class EntryBean implements EntryBeanInterface { @RequestParameter("entry") private Long entryId; }
  • 25. Access Data Navigation Control Validation Data Forms Actions Model Object Page Data Relational Templates Binding Mapping map.root :controller => "homme" # should be "home" http://zef.me/2308/when-rails-fails
  • 26. Access Data Navigation Control Validation Data Forms Actions Model Object Page Data Relational Templates Binding Mapping data model entity class classes orm JPA active record actions Java/Seam boilerplate code Ruby data validation navigation loose coupling servlets controllers page templates JavaServer Faces forms no/little consistency checking JSF tags embedded html data binding JSF + Seam access control Acegi
  • 27. Access Data Navigation Control Validation Data Forms Actions Model Object Page Data Relational Templates Binding Mapping - separate languages for separate concerns - linguistically integrated - compile-time consistency checking - 100% code generation (no scaffolding)
  • 28. Access Data Navigation Control Validation Forms Data Model Actions entity Blog { name :: String (id) Object Page Templates Data Binding Relational entries -> Set<Entry> Mapping authors -> Set<User> } entity Entry { url :: String (id) title :: String (name) text :: WikiText blog -> Blog (inverse=Blog.entries) author -> User (inverse=User.entries) created :: DateTime } entity User { username :: String password :: Secret blogs -> Set<Blog> (inverse=Blog.authors) entries -> Set<Entry> (inverse=Entry.author) }
  • 29. Access Data Navigation Control Validation Data Forms Actions Model Object Page Data Relational Templates Binding Mapping define page entry(e : Entry) { header{output(e.title)} output(e.text) “Posted by “ output(e.author) “ on “ output(e.created) navigate(editentry(e)){“Edit”} }
  • 30. Access Data Navigation Control Validation Data Forms Actions Model define page editentry(e : Entry) { Object Page Data Relational Templates Binding Mapping form{ input(e.url) input(e.title) input(e.text) input(e.author) input(e.created) action(“Save”, action{ return entry(e); }) } }
  • 31. Access Data Navigation Control Validation Data Forms Actions Model Object Page Data Relational Templates Binding Mapping entity Entry { url validate(isUniqueEntry(this), “Entry with that URL already exists”) }
  • 32. Access Data Navigation Control Validation Forms Data Actions access control rules Model Page Data Object Relational principal is User Templates Binding Mapping with credentials username, password rule page entry(e : Entry) { !e.private || principal in e.blog.authors } rule page newentry(b : Blog) { principal in e.blog.authors } rule page editentry(e : Entry) { e.author == principal }
  • 33. Access Data Navigation Control Validation Data Forms Actions Model Object Page Data Relational Templates Binding Mapping - separate languages for separate concerns - linguistically integrated - compile-time consistency checking - 100% code generation (no scaffolding) - order of magnitude decrease in code size
  • 34. http://researchr.org
  • 35. Access Data Navigation Control Validation Data Forms Actions Model Object Stratego/XT Page Data Relational Templates Binding Mapping Domain-Specific Language Engineering
  • 36. Access Data Navigation Control Validation Data Forms Actions Model Object Stratego/XT Page Data Relational Templates Binding Mapping WebDSL Java
  • 37. Access Data Navigation Control Validation Data Forms Actions Model Object Stratego/XT Page Data Relational Templates Binding Mapping Core WebDSL Java WebDSL
  • 38. Access Data Navigation Control Validation Data Forms Actions Model Object Stratego/XT Page Data Relational Templates Binding Mapping Python Core WebDSL Java WebDSL C#
  • 39. Access Data Navigation Control Validation Data Forms Actions Model Object Stratego/XT Page Data Relational Templates Binding Mapping Python Core WebDSL PIL Java WebDSL C#
  • 40. Access Data Navigation Control Validation Data Forms Actions Model Object Stratego/XT Page Data Relational Templates Binding Mapping Component-Based Language Engineering DM PIL Python UI PIL AC PIL + WebDSL Core WebDSL PIL Java C# DV PIL
  • 41. Access Data Navigation Control Validation Data Forms Actions Model Page Data Object Relational - separate languages for separate concerns Templates Binding Mapping - linguistically integrated - compile-time consistency checking - 100% code generation (no scaffolding) - order of magnitude decrease in code size http://webdsl.org http://strategoxt.org http://researchr.org