Monday, 8 November 2010

Book Review: DSL’s in Action

dslsinactionAfter my last review Manning Books were kind enough to let me have another book to review namely  DSLs in Action by Debasish Ghosh.

When I started reading I discovered the book focuses on languages on the Java Virtual Machine (JVM) specifically Java, Ruby, Groovy, Clojure and Scala and I freely admit that I have no experience in any of these languages, so I would not only be learning what Debasish has to say about DSLs, their use and creation but also getting an introduction into the languages mentioned.

The book is split into 3 parts over 9 chapters and with additional appendices, all the examples in the book are based on a equities trading domain (stocks & shares) and through out the book Debasish provides the reader with information about the domain to help you grasp what the DSLs being discussed are trying to achieve and how different languages can implement the various concepts being discussed.

I did run into one problem quite quickly in that the electronic copy of the book I had to review did not contain any appendices and Debasish mentions that he has put a lot of the basic concepts he will be discussing in the appendix 1 and in fact says after chapter 1 you should read appendix 1 before continuing. 

Part 1: Getting Started with Domain Specific Languages

Part one has 3 chapters which aim to introduce the reader to the world of DSLs what they are, how they help, existing DSLs you may be unaware of (SQL would perhaps be the best known) and the different types of DSL - internal and external. With this groundwork laid Debasish finishes off part 1 by covering integration patterns for both internal and external DSLs.  You will find that this part is light on code having to deal with all the theory and background to DSLs rather than focusing on how you create them in the language of your choice.

Part 2: Implementing Domain Specific Languages

Part two consists of 5 chapters and is all about implementing DSLs with Debasish stating at the start of chapter 4:

Every architect has his own toolbox that contains recipes of designing beautiful artifacts. In this chapter we will build our own toolbox for architectural patterns that you can use for implementing DSLs.

He then starts with patterns for implementing internal DSLs before moving on to show how internal DSLs can be created in Ruby, Groovy, Clojure, and Scala; then Debasish moves on to creation of external DSLs with tools such as ANTLR and XText as well as how to build an external DSL in Scala.  This part is heavy on code with all five chapters revolving around showing the reader how to build a part of a DSL for the example domain (stocks & shares trading) in each of the languages and external tools.

Part 3: Going Forward

In part three Debasish attempts to take a look at the future of DSL’s with growing language support, DSL workbenches and evolution of DSL’s. This chapter has very little code as Debasish is trying to show the user what he believes will happen with DSLs in the future and the sort of support you should expect to see in languages and tools to help you create DSLs.


It would seem that Debasish is a fan of Scala having dedicated 2 chapters in the book to explaining how to create internal and external DSLs with the language; having not developed with Scala I cannot comment on whether the focus on the language is justified or not and can only bow to what I must assume is Debasish greater knowledge in this matter.

You will find though as you read through the book there are more and more references to material that is in the appendices which Debasish recommends you read, so unless you have good working knowledge of DSLs and of all the languages mentioned I would expect you may need to be flicking backwards and forwards to ensure you understand all the material in the book.

DSLs in Action is a good book for anybody that is interested in DSLs especially so if you are developing on the JVM, even more so if you develop in Scala, and should provide you a good grounding in deciding the type of DSL to implement and the tools and/or skills to do so.

Many thanks to Manning books and Debasish Ghosh for allowing me to review this book.

No comments:

Post a Comment