Programming Groovy 2 – For the experienced Java developer seeking dynamic productivity – #programming #bookreview

Programming Groovy 2

Dynamic Productivity for the Java Developer

Venkat Subramaniam
(Pragmatic Bookshelf, paperback)


The programming language
Groovy has a bit of a checkered past. Before it reached Release 1 in early 2007, it was almost abandoned because of a series of development problems. But some dedicated developers reworked it, gave it new life, and helped it gain acceptance in a widening array of commercial projects. Release 2.0 became available last year, and you can download 2.1, with 2.2 in beta. Groovy is doing groovy now, thank you very much (and thank the Grails web application framework, too).

In his new book, which keys off of his 2008 Groovy 1 edition, Dr. Venkat Subramaniam  describes Groovy 2 as “lightweight, low-ceremony, dynamic, object-oriented, and runs on the JVM [the Java Virtual Machine].”

He notes: “Groovy is open sourced under the Apache License, version 2.0. It derives strength from various languages such as Smalltalk, Python, and Ruby, while retaining a syntax familiar to Java programmers. Groovy compiles into Java bytecode and extends the Java API and libraries. It runs on Java 1.5 and newer. For deployment, all we need is a Groovy Java archive (JAR) in addition to the regular Java stuff, and we’re all set.”

Groovy is not for coding beginners, nor is it a means to avoid learning Java. This book–well written and nicely illustrated with short code examples and screenshots–”is aimed at Java programmers who already know the JDK [Java Development Kit] well but are interested in learning the Groovy language and its dynamic capabilities,” Dr. Subramaniam says.

He has organized his 19-chapter, 333-page book into three major parts:

Part I: Beginning Groovy – Focuses on the fundamentals of the language but deliberately skips the basics of programming. The book, after all, is aimed at “experienced Java programmers.”

Part II: Using Groovy – Shows “how to use Groovy for everyday coding–working with XML, accessing databases, and working with multiple Java/Groovy classes and scripts….” Also delves into Groovy extensions and additions to the JDK.

Part III: “MOPping Groovy” – The odd title may conjure up a brief image of mopping up spilled gravy. But this part deals with “Groovy’s metaprogramming capabilities….” The coverage includes: (1) metaobject protocol (MOP); (2) “how to do AOP-like operations in Groovy” [AOP = “aspect-oriented programming”]; and (3) “dynamic method/property discovery and dispatching,” as well as Groovy’s “compile-time metaprogramming capability….”

If you are a Java developer seeking new tools. new challenges, and new horizons, this could be the right time and right way to get your groove on: with Groovy 2 and Dr. Venkat Subramaniam’s fine how-to guide.

“Groovy is an attractive language for a number of reasons,” the author says, naming four key ones:

“It has a flat learning curve.”

“It follows Java semantics.”

“It bestows dynamic love.”

“It extends the JDK.”

“Groovy,” he adds, “feels like the Java language we already know, with a few augmentations.”

Si Dunn

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: