April 14, 2008
Introducing Domain Specific Languages
One of the reasons for using dynamic methods invocation (as highlighted by a few posts I made over the past few weeks) is to implement an internal Domain Specific Language (DSL) in Delphi. As this topic is quite new to the Delphi community, it could be worth exploring it. I don't have a full paper on the subject, so the only thing I can do right now is share the key points of the slides a prepared for a recent talk on the subject. This material covers the introduction, later I'll get back to Delphi specific examples.
Domain Specific Languages
- Old technology, having a second youth
- Popular in LISP and Smalltalk days
- The SQL example
Borrowed from real life
- Starbuck DSL: “Venti non-fat no-foam Latte”
- Sport DSLs, Football/Soccer:“Striker scored with a header after an assist from a corner kick”
DSL and Myself
- It all started attending a talk by Neal Ford
- He works with “DSL guru” Martin Fowler
- Very popular in Ruby (Rails DSLs)
- Becoming popular in Java
- “Curly-brace” languages have limited DSL support
- What about Delphi? Before the end of his talk I had a short demo and a few ideas
Domain Specific Languages
- A high-level language shared by developers and customers
- Or sellers and buyers, in the real world
- Or different groups of developers
- One case is that of “Fluent languages”,English-like (and not only English!)
DSL are focused and limited
- A programming language, but not a general purpose one
- Very narrow purpose
- Not “Turing complete”
- Generally no loops, limited conditions
More Examples
- LINQ
- Textual DFM
- XML notations
External DSL
- Completely separate syntax and processing from the host language
- Uses a separate compiler or interpreter
Internal DSL
- Code written with the syntax of the host language
- Better if a dynamic language (Ruby, LISP, Smalltalk)
- Uses a language subset
There is a large debate between:
- UML and/or MDA
- DSL
- Traditional OOP models
To DSL or not?
- Increased productivity with DSL, investment in language creation
- External DSL: lack of symbolic integration, language cacophony, better for non-programmers
- Internal DSL: limited by host language syntax, harder for non-programmers
I know, I know, hard to understand... but you can find countless links on the web to get more information... and I might provide some as well. Still, my goal is to get to Delphi DSL coding ASAP.
3 Comments
Introducing Domain Specific Languages
It seems like the term "domain specific language" is a fairly loose definition. If you import data from a spreadsheet, the spreadsheet could be a domain specific language, and one that represents data in a way that is comfortable for users and not too foreign to a database. I have found that to be a very productive and flexible interface to work with. I will be very interested to see how developing a further understanding of an external domain specific language can help me in this area.Comment by Jack Rodenhi on April 15, 00:07
Introducing Domain Specific Languages
For the sake of practicity about DSL: Do you think that ABAP, the Domain Specific Language of the almost all-mighty and succesfull ERP named SAP, one of the greatest features is a practical joke? Domain Specific Languajes is a great tecnique when you have a requirement of flexibility in your applications, no matter the size of them. Of course, the market you're targeting is what matters, but I think even no-brainers could bennefit from a tool whenever they try to customize your apps further. I have implemented something myself, and this DSL turn to be one of the major advantages. I even have a post about Dynamic Method Invocation too (in spanish). http://salvador.oversistemas.com/2007/11/llamada-dinamica-metodos_19.html Way to go, Marco!Comment by Salvador Gomez Retamoza [http://salvador.oversistemas.com] on April 15, 22:38
Post Your Comment
Click here for posting your feedback to this blog.
There are currently 0 pending (unapproved) messages.



Introducing Domain Specific Languages
Comment by Jolyon Smith [http://www.deltics.co.nz] on April 14, 23:34