Author: Debasish Ghosh
Aimed at: Advanced and well-read programmers
Pros: A deep and detailed coverage of a complex topic
Cons: Assumes a great deal of pre-requsite knowledge
Reviewed by: Mike James
DSLs should be part of the advanced programmer's collection of tools. Is this the book to choose?
Domain Specific Languages (DSLs) are a very trendy topic at the moment and there are some situations in which they do make things simpler. In this sense DSLs should be part of your personal collection of tools, but how to find out about what can be a complex topic laden with jargon and difficult computer science techniques? Well, there is no way of avoiding the fact that DSLs are a difficult and very technical topic and really you just have to take the plunge and do the work. In this book there are few concessions to the under-educated programmer - you simply have to know things to get anywhere with it.
It starts off gently enough with the argument for DSLs and a brief classification of types of DSL. Chapter 2 is where the real work starts, however, with an example implemented in Java. It is here you will first realize what the level of required knowledge is to deal with the material presented. In one fairly short Java example we have the Builder design pattern, fluent interfaces and higher order functions. You may well need to go off and research many of the topics mentioned if your background knowledge doesn't match that of the author. The extended discussion of the example takes us on to Groovy and a deep examination of the theory of DSLs. Chapter 3 extends this to DSL-driven application development. This is mostly about using DSL to produce something that is complete rather than a fragment and it focuses on integrating a DSL with a larger application. This is an aspect of DSLs that isn't much discussed but again, valuable though this chapter is, you need to be fairly well-read to make sense of it all.
Part 2 of the book takes the form of a number of DSL implementations. First off we look at internal DSL implementations - essentially extending existing languages. After an overview of implementation patterns we move on to our first large example, a DSL in Ruby, Groovy and Clojure. Then we have a chapter on internal DSL design in Scala. Next the subject switches to external DSL designs - i.e. doing the entire job complete with syntax and semantic coding. Chapter 7 deals with parsers and other tools. Chapter 8 outlines external DSLs in Scala. This part of the book, especially the sections on external DSLs, are perhaps the most valuable but again keep in mind the high level of background knowledge you need to keep up with the author - a passing acquaintance with Ruby, Groovy, Clojure and Scala won't get you very far.
The final part of the book looks to the future of DSLs and the way languages are adding meta-programming facilities just to allow easier DSL construction and the news tools for external DSL construction.
This really is a great book. It is deep and it goes places other books just dream of visiting. If you want to know about DSLs in depth then read it, but be prepared to also read up on the missing information in your technical background. The author is clearly a very clever programmer and not all of us can keep up. If the book has a defect then it is simply that it doesn't cover DSLs in the .NET or Windows environment - but if it did then I would have to add a few more languages and another block of knowledge to the requirements to get anything from this book.
Given that a constant complaint is the low level of most so-called "advanced" books on programming, I can hardy complain about the erudite nature of this particular book, and I am most certainly not complaining. It is a really good book on DSLs, but you do need to be warned of the minimum system requirements for the potential reader. If you are up to the challenge then you will get a great deal of goodness from it.