Feeds

Making Java Groovy

It's Ruby, and then some

  • alert
  • submit to reddit

Secure remote control for conventional and virtual desktops

It is increasingly important to differentiate between Java the programming language and Java the platform.

While there have long been other languages that have targeted the platform, the best known being Jython – a version of the Python language that compiled down to Java byte code to be executed by the Java Virtual Machine (JVM) – recent moves have seen the emergence of "official" support for scripting languages (JavaScript, for example), JRuby, Sun's own JavaFX and more.

From being a single language, multi-OS environment, the Java platform is increasingly both multi-language and multi-OS. And in this new eco-system the Groovy language seems to be thriving nicely.

Groovy is, to quote from its home page, "an agile dynamic language for the Java Platform". What this means in practice is explained in some detail by Groovy In Action, a big book in every sense of the word. It begins with the assumption that the reader is familiar with both the Java language and the platform, and from there proceeds to explore the new world of Groovy programming.

Groovy offers many of the benefits claimed for Ruby – higher levels of abstraction, concision, less boiler-plate code, closures, mixins, elements of functional programming, dynamic programming features, and so on.

However, unlike Ruby, Groovy has a syntax and a structure that is immediately obvious to a Java programmer. Furthermore, it enables mixed programming – it can make full use of existing Java classes and packages, (including the full set of standard Java libraries), and Java code can (mostly) make full use of Groovy classes in turn.

The first part of the book explores the Groovy language, doing a good job of showing the reader all of the gee-whiz features that make it different to Java. The point is that this isn't just Java with fewer key-strokes (though it's certainly possible to use it that way). Groovy's support of closures, for example, is intuitive and powerful and offers a facility that plain old Java is currently lacking.

Having successfully toured the language, the second part of the book dives into the Groovy libraries, in particular Builders, database programming, XML, integration, and the GDK. As with Java there's a lot more to Groovy than just the syntax and program structure, the libraries provide high-levels of functionality to address common programming problems.

The final part of the book looks at Groovy in action day-to-day, from opening up the Ant build tool, to unit testing, COM integration under Windows, and introducing the Grails framework. In the same way that Rails was the lure to Ruby for many programmers, the Grails web application framework is enticing developers to take a look at what Groovy has to offer.

Aside from the intrinsic interest in the subject matter, it has to be said that this is a book that is very readable, engaging, and does a great job of slotting Groovy into the broader world of software development.

Of course, it asks provocative questions as well as answering them. For example, there's a huge clamour to add closures to the Java language at the moment (as part of Java 7). With Groovy around this reader at least wonders why anyone would want to complicate the core Java language yet again?

Groovy in Action

Groovy in actionVerdict: Highly recommended

Author: Dierk Koenig (with Andrew Glover, Paul King, Guillaume Laforge and Jon Skeet)

Publisher: Manning Publications

ISBN: 1-932394-84-2

Media: Book

List Price: £35.99

Buy this book at Register Books at Reg Developer's special discounted price. ®

The essential guide to IT transformation

More from The Register

next story
The Return of BSOD: Does ANYONE trust Microsoft patches?
Sysadmins, you're either fighting fires or seen as incompetents now
Munich considers dumping Linux for ... GULP ... Windows!
Give a penguinista a hug, the Outlook's not good for open source's poster child
Intel's Raspberry Pi rival Galileo can now run Windows
Behold the Internet of Things. Wintel Things
Linux Foundation says many Linux admins and engineers are certifiable
Floats exam program to help IT employers lock up talent
Microsoft cries UNINSTALL in the wake of Blue Screens of Death™
Cache crash causes contained choloric calamity
Eat up Martha! Microsoft slings handwriting recog into OneNote on Android
Freehand input on non-Windows kit for the first time
prev story

Whitepapers

Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Top 10 endpoint backup mistakes
Avoid the ten endpoint backup mistakes to ensure that your critical corporate data is protected and end user productivity is improved.
Top 8 considerations to enable and simplify mobility
In this whitepaper learn how to successfully add mobile capabilities simply and cost effectively.
Rethinking backup and recovery in the modern data center
Combining intelligence, operational analytics, and automation to enable efficient, data-driven IT organizations using the HP ABR approach.
Reg Reader Research: SaaS based Email and Office Productivity Tools
Read this Reg reader report which provides advice and guidance for SMBs towards the use of SaaS based email and Office productivity tools.