Groovy Recipes

The Groovy language is relatively new on the scene. I confess that I had not even heard of it until early this year when I came across a Developer Works article about unit testing with Groovy, written in 2004. So I am a little late to the party, but the article did intrigue me and the new addition to the Pragmatic series, “Groovy Recipes” came along at just the right time for me to jump on board. This book is a no-nonsense, solid introduction to groovy. It is specifically written with the experienced Java programmer in mind, but I found it useful even though my Java experience is primarily as a hobbyist. Davis brings his extensive experience with Groovy and Java to the table and has written an excellent primer and reference that is fully worthy of the Pragmatic label.

This book is not a “How to Program” using Groovy as the language. Davis assumes knowledge of programming, and more specifically Java on the part of the reader. This means that there are no tedious filler chapters at the beginning explaining how a computer needs programs to do things, or what variables are. Even the introduction is rather brief as Davis immediately moves into describing what Groovy is and how it works with code samples. If you have fallen into the habit of pushing right past the first 2 or 3 chapters of any programming book you pick up, this will be a refreshing change of pace. As I mentioned, I am not a Java expert by any means. I still found it easy to follow the clear writing in this book that was teamed with good examples.

The format for the examples and explanation is that each section is numbered and named. Following the heading of that number and name, the recipe code is given. This is followed by the explanation and discussion of issues related to the code. The section names are not clever or cute to be entertaining, they clearly state what is in the section and thereby make the table of contents useful.

The format of the book is extremely versatile. Like many other cook-book format books I’ve read recently, this one is broken down into many small sections that provide code for various situations and uses. For the person already using Groovy, there may be no real need to read this through from beginning to end. It is very easy, between the table of contents and the index to jump right to any desired example of functionality or syntax. The physical layout of the book makes finding things easy also as this is not a huge book. Flipping through it to find something I’d read earlier was very easy for me.

That said, while it is not necessary to read from start to finish, doing so is very easy. This cannot be said of all books that follow the recipe format. Many have no connection or very rough flow between the sections and jump all over the place. “Groovy Recipes” flows very nicely and moves the reader on a very natural progression from syntax and operators, on to useful topics and common functionality. The book begins with how to install Groovy and ends discussing such topics as Grails, a Groovy web framework and working with web services using Groovy.

The only trouble I ever had following the book was due to a somewhat humorous feature of the Groovy language. Reading Groovy feels a lot like reading pseudocode to me. It is so succinct and natural that it just flows. I’d read a recipe, and move onto the explanation and feel like I had just jumped backwards. I’d been reading the code and it felt like I was just reading instructions, it was so self-explanatory. I don’t think of this so much as a problem with the text as it is an endorsement of the language. I’ve always been a bit of a fan of RAD languages. Groovy brings many RAD type capabilities to Java and the JVM. This book has made me quite excited about the possibilities of Groovy and working with it has been quite a bit of fun.

For the Java developer looking to use Groovy as a complement to their work, or as a scripting language for things like testing code, this book could be just enough to get them up to speed and running without having to wade through a lot of unnecessary extras. For anyone who wants to use Groovy in any capacity, I predict this would be one of those books that they would want to keep close, and find they grab first. It has that all important lack of junk clogging up access to all the good information.

Davis is eminently qualified as a Groovy expert. Often times when something newer is gaining in popularity there are a lot of people who will churn out books of greatly varying quality in an attempt to cash in on the momentum. Davis has already written multiple solid Java oriented books and is the editor in chief at and is a sought after speaker as a programmer. Guillame LaForge, Groovy project manager, states in the preface that even he found a few tips here that he did not know. This book really stands out in an extremely positive way and could be one of the best programming books I’ve read in quite a while.

Title: Groovy Recipes
Author: Scott Davis
Publisher: The Pragmatic Bookshelf
Pages: 249
ISBN: 0978739299
Rating: 10/10
Tagline: Greasing the wheels of Java.

Posted under Java, Programming Tags: , , ,

2 Comments on "Groovy Recipes"

  1. Scott Davis says:

    All I can say is, “Wow!” and “Thanks.” As an author, this is the kind of reaction you hope for when you write a book.

    Groovy Recipes is the sort of book that I like the most — no nonsense, down to earth, get in/get out/get on with it. I’m pleased that you feel the same way about it.


  2. April 2008 Reviews…

    C# 3.0 in a Nutshell …if every professional developer working in .NET knew and applied the contents of C# 3.0 in a Nutshell, we’d be in a far better state as a development community and industry. Jon Skeet, Author of C# in Depth, Coding Blog…

Leave a Reply

Your email address will not be published. Required fields are marked *