I just spent half an hour watching Martin Fowler’s Introduction to Domain Specific Languages presentation at last year’s JAOO conference (nice name for a conference, i must say). It’s a quite good introductory talk. Fowler acknowledges Lisp’s strength in the DSL camp, takes the opportunity to make fun of it, puts XML closer to where it deserves and does a good job explaining the differences and trade-offs between what he calls internal and external DSLs. For those of you prefering reading to watching, the talk covers the first half of this article.
Fowler likes to call DSL-based programming Language-Oriented programming, and had what looks like an interesting conversation with Neal Ford last August: if you liked the above video, just follow this link. I have not finished watching it yet, but i’ve enjoyed its first 20 minutes. As a teaser, here’s how the talk begins:
Why is there so much XML mixed in with my Java code? Why would not everybody shut up already about Ruby on Rails? It seems like any time you talk to someone about Ruby on Rails they are irrationally exuberant about it and there has got to be some reason for that and why do things like aspects exist? Why do we actually need something like aspects if Java is enough and is there an evolutionary step beyond object-oriented programming? Is the abstraction layer we have been using so far, is that sufficient for the problems that we are trying to solve today and what the heck is language-oriented programming anyway? That is what Martin and I am here to talk about is this idea of language-oriented programming.
Enjoy!
October 22, 2007 at 11:06 pm
DSL’s are something that we’re rediscovering (again), pretty much everything is being reintroduced after someone spots it on an “ancient” book, take for example garbage collectors or lambda expressions in Lisp.
Using a DSL for solving a very particular task is fine, however, we programmers want to have the power to do anything under our fingertips. That is, DSL’s should allow you to do anything, but using a particular syntax that enables you to write specific programs more easily. Take for example Boost.Spirit or Boost.Python. As you already know, C++ is a complex language that offers you a lot of goodies, but using standard C++ to build a Lex/Yacc parser is a bit cumbersome. Luckily you can abuse from some of its features (namely operator overload) to build something as cool as Boost.Spirit, which allows you to write inline Lex-like syntaxes.
By the way, if you plan to give some scriptable feature to your application, ensure that you’re giving a “Real language ™”. Transcending Language Bias in Scriptable Applications is an old (but fine) article about this, and I’m sure you’ll like the Emacs/Lisp reference