Tuesday, 7 September 2010

Review of Groovy for Domain-Specific Languages

I recently read the Groovy for Domain-Specific-Languages book by Fergal Dearle. The book essentially covers what Groovy is, what DSL is and how to apply Groovy to incorporate a DSL for your applications.

After reading the book I have to agree that if you intend to create a DSL, which we basically do unintentionally all the time, then Groovy can fulfil these requirements with ease and simplicity.

The book is a easy to read book with clear text, syntax and examples without being too thick and not seem a like a javadoc of information overload. It is rather quick to read through due to the nice flow. The layout do make it a nice reference for myself in the future as it is laid out clearly and contains a large variety of working examples.

The book starts of with first explaining the concepts of what DSL is, what it means in terms of computer science history and how we already use them.

It then goes on to explain in clear but complete detail what Groovy is and does. Actually these chapters are a good introduction to Groovy book in themselves.

Dearle then procedes to explain the main technologies built on top or as part of Groovy such as the web framework: Grails, the Groovy Ant builder scripting tool: Gant, Groovy & Grails ORM database mapper: Gorm, BDD frameworks and similar technologies. This it does in enough detail so that you have a good idea what they do and can experiment with yourself afterwards.

The last half of the book Dearle then brings Groovy and the related technologies back into the DSL fold and explains why and how Groovy is excellent for DSL writing. E.g: Groovy’s dynamic nature, closures, or the multitude of “Builders” which basically are DSLs outright.

These chapters of the book has a large set of basically Cook Book examples of Groovy DSL writing, builders and finishes with how to integrate Groovy with Spring, XML, Ant and existing Java applications.

I was already aware of Groovy’s suitability as a DSL language, but I am now even more convinced of its power, ease and fit as a or rather the DSL. If you would like to have a peak at the book there is a free chapter, or why not buy the book? ( amazon.co.uk, amazon.com, Packt)

(Note: this book was also reviewed on slashdot this summer)

No comments: