Feeds

Making Java Groovy

It's Ruby, and then some

  • alert
  • submit to reddit

New hybrid storage solutions

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. ®

Reducing the cost and complexity of web vulnerability management

More from The Register

next story
New 'Cosmos' browser surfs the net by TXT alone
No data plan? No WiFi? No worries ... except sluggish download speed
'Windows 9' LEAK: Microsoft's playing catchup with Linux
Multiple desktops and live tiles in restored Start button star in new vids
iOS 8 release: WebGL now runs everywhere. Hurrah for 3D graphics!
HTML 5's pretty neat ... when your browser supports it
Mathematica hits the Web
Wolfram embraces the cloud, promies private cloud cut of its number-cruncher
Google extends app refund window to two hours
You now have 120 minutes to finish that game instead of 15
Intel: Hey, enterprises, drop everything and DO HADOOP
Big Data analytics projected to run on more servers than any other app
Mozilla shutters Labs, tells nobody it's been dead for five months
Staffer's blog reveals all as projects languish on GitHub
SUSE Linux owner Attachmate gobbled by Micro Focus for $2.3bn
Merger will lead to mainframe and COBOL powerhouse
iOS 8 Healthkit gets a bug SO Apple KILLS it. That's real healthcare!
Not fit for purpose on day of launch, says Cupertino
prev story

Whitepapers

Secure remote control for conventional and virtual desktops
Balancing user privacy and privileged access, in accordance with compliance frameworks and legislation. Evaluating any potential remote control choice.
WIN a very cool portable ZX Spectrum
Win a one-off portable Spectrum built by legendary hardware hacker Ben Heck
Intelligent flash storage arrays
Tegile Intelligent Storage Arrays with IntelliFlash helps IT boost storage utilization and effciency while delivering unmatched storage savings and performance.
High Performance for All
While HPC is not new, it has traditionally been seen as a specialist area – is it now geared up to meet more mainstream requirements?
Beginner's guide to SSL certificates
De-mystify the technology involved and give you the information you need to make the best decision when considering your online security options.