Title: Groovy in Action
Author(s): Dierk Konig, Andrew Glover, Paul King, Guillaume Laforge, Jon Skeet
Publisher: Manning Publications
This is not a new book but it was in my wish list for a while. After working on couple of side projects with Groovy I've decided to read this book, in line with my new year resolution of getting back to the habit of reading more books. Structured formal learning in a form of book is still extremely valuable.
Being a Java guy for the last decade or so, it is not that difficult to get into Groovy. In fact, the language is so well designed for easy transition for Java programmers. Not sure whether transition is a right word here as you are still very much in Java as you work with Groovy!
This book is divided into three parts:
- Part 1: The Groovy language -- This is more like language-specific details
- Part 2: Around the Groovy library -- This is more like language reference
- Part 3: Everyday Groovy -- This part is more like day-to-day tips and tricks
The book is very well written and elaborate. First part of the book, you may read it at a relatively fast pace if you are already working with Java. Of course, you will always find something extra or something different that you get by using Groovy, not to mention the syntactical sugar! Chapter on Closures is very well written.
Second part goes into in-depth description of the Groovy library details. Here is where you appreciate Groovy even more. The chapter on Builders is a nice one. I skipped AntBuilder as I'm familiar with Gant, a Groovy based build system that uses ANT tasks. Also, skipped SwingBuilder as I'm not much into Swing.
Third part is more like a cook book, applying some of the knowledge from the first two parts. 'Useful Snippets' chapter is a must read and so is 'Writing automation scripts'.
- Further appreciate the beauty of Groovy with its 'beauty through brevity' approach
- Groovy's approach of everything is an Object and no primitives, its excellent operator overriding -- the language bases its operators on method calls and allows these methods to be overridden.
- GStrings is an excellent concept allowing placeholders in its literal declaration.
- Working with collections in Groovy is a breeze compared to Java. Groovy not only uses the same abstractions provided by Java, it even works on the very same classes that make up the Java Collections API.
- Closures: Arguably one of the most powerful features of Groovy. Very well explained in this book, along with Closure scoping.
- Groovy's mutimethods feature -- its mechanism of method lookup taking the dynamic type of method arguments into account.
- Groovy's ability to work with files and I/O is top-rate. If you are a Java developer you would certainly like the ease with which these operations are carried out with very little clutter, from the code point of view.
- DataSets is a great concept that brings parser approach of programming language for checking SQL select expression at compile time.
Overall, this is an excellent reference book for Groovy. Very detailed, and the examples are non-trivial. Strongly recommend the book.