TechBookReport logo

Keywords: Groovy, Java, JVM, scripting languages

Title: Programming Groovy

Author: Venkat Subramaniam

Publisher: Pragmatic Bookshelf

ISBN: 1934356093

Media: Book

Level: Introductory

Verdict: Recommended


While not quite as numerous as the books on Ruby, the Groovy titles are certainly starting to accumulate. This one, by Venkat Subramaniam, co-author of Practices of an Agile Developer, is a single volume introduction that is pitched at Java programmers interested in picking up a dynamic language. It's that point about Groovy being a dynamic language that is the main focus of the book, and it's a message that is explored pretty much from the first page.

The opening section of the book introduces Groovy, and explains what it is, why it's interesting and how it uses the underlying Java platform to do all kinds of clever things that are hard to do with Java but easy to do with a dynamic language. The benefits of dynamic typing, reflection and closures are clearly explained along the way. By the end of the first section you would have picked up the core ideas and seen some simple but effective Groovy code.

Part two moves on to look at how Groovy can be used to tackle specific areas: the Groovy Development Kit (GDK), XML, databases and inter-operating with the Java language. The emphasis is on using short snippets of code to achieve things that take reams of Java code - it's not just that Groovy is less verbose, it's also the fact that you can concentrate on the problem you're solving and not the scaffolding that Java code often requires.

The third and final part of the book is devoted to the Meta-Object Protocol - imagine Java reflection on steroids and you'll get some idea. It enables you to change classes on the fly or to add new methods or logic as you go along. For those who already have some familiarity with Groovy this is likely to be the most interesting part of the book as it really tackles some advanced topics. It's the one part of the book where some longer and more extended examples would have been more useful. There are chapters devoted to method injection, dynamic class creation, unit testing and mock objects, Groovy builders and creating DSLs.

Overall this is a readable and interesting book. The material in the book largely overlaps with the highly recommended Groovy In Action. This book is more up to date as far as the language is concerned. On the other hand Groovy In Action scores more highly in terms of design and also the quality of the writing. If you want a book on Groovy then either (or both) are good.

Hit the 'back' key in your browser to return to subject index page

Return to home page

Contents © TechBookReport 2008. Published July 24 2008