Book Review: Domain-Specific Languages by Martin Fowler
Friday, March 18th, 2011Executive Summary
The book succeeds quite well to demystify and rehabilitate the development of domain-specific languages. It points out in particular all the small specialized languages that many of us use every day. Further, it provides a good catalog of useful techniques illustrated by examples in various languages.
Full Review
Introduction
Domain-Specific Languages was written by Martin Fowler with Rebecca Parsons and published by Addison Wesley in 2011. It aims at both making the case for using domain-specific languages in everyday programming and providing a set of techniques often used in their implementation.
Structure
The book is divided into five parts. The first one is dedicated to a discussion about DSLs, what they are, when they can be useful, and a quick overview on how to get started. This is the only part of the book to be read linearly. The last four parts are presenting patterns, for lack of a better word, that can be applied when creating a DSL. It is useful to get acquainted with the material but in depth reading can be done as needed.
Content
The book is very rich in content accompanied by a lot of tailored examples. It is more than enough to get you started writing a DSL and making the case for it. There is also enough to get you confused on the best course to follow for a particular application.
On the negative side, regrettably I still fail to form a good idea of what a ‘Semantic Model’ is and truly feel what its benefits are. Martin Fowler is adamant that it is a very useful piece to have between the syntax and the domain model. It would have been nice to see a non-trivial example in the book or a reference to one that is widely available to illustrate the concept.
The second regrettable element in the book is the lack of references to the academic literature on the topic to support exploring some of the concepts in more depth. Not only does a lot of the research on languages in general apply in the simpler context of DSLs, but a lot has been written on the particular topic. Google certainly is helpful but it would have been nice to have a few curated pointers to things written outside the ‘Thoughtworks world’ , in paricular on grammars and on semantics. I am also suspicious of the way Martin Fowler takes great care to install his vocabulary. I sometimes had the feeling that the book was there as much to support ‘Thoughtworks’ business as it was to instruct the reader. That being said I am naturally quite suspicious. This is particularly the case on how the author defines embedded vs internal vs external DSLs.
Style
This is the first book I have read from Martin Fowler but I do follow his Bliki. Unfortunately the style of the book is close to that of the Bliki. And that does not work for me, as I expect a more formal, authoritative style to a book. As it is, the first-person singular is used way too much to my taste. This often turns to be an opinion book (and that is usually stated in-situ by the author himself). In other cases, the author debates alternatives, then concludes to the superiority of one or the other (in his opinion), rarely resorting to other sources to support either side of the argument. Finally a lot of space is devoted to explaining why some topics are not covered, or not expanded once again without redirecting the reader to other sources that discuss it. While a lot of it would be just fine on the context of Bliki, it turned out to be very irritating when reading the book.
Final Words
The book may be self-serving and sometimes fail to expand beyond the author’s opinions into the wider world. Having said that, it is full of valuable information and the last four sections of the book will certainly prove useful to a lot of us. Many of my criticisms can be remedied by searching the web for material on DSLs, formal grammars and formal semantics.

