Feeds

Making Java Groovy

It's Ruby, and then some

  • alert
  • submit to reddit

Beginner's guide to SSL certificates

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

Secure remote control for conventional and virtual desktops

More from The Register

next story
Nexus 7 fandroids tell of salty taste after sucking on Google's Lollipop
Web giant looking into why version 5.0 of Android is crippling older slabs
Be real, Apple: In-app goodie grab games AREN'T FREE – EU
Cupertino stands down after Euro legal threats
Download alert: Nearly ALL top 100 Android, iOS paid apps hacked
Attack of the Clones? Yeah, but much, much scarier – report
Microsoft: Your Linux Docker containers are now OURS to command
New tool lets admins wrangle Linux apps from Windows
Bada-Bing! Mozilla flips Firefox to YAHOO! for search
Microsoft system will be the default for browser in US until 2020
Facebook, working on Facebook at Work, works on Facebook. At Work
You don't want your cat or drunk pics at the office
prev story

Whitepapers

Choosing cloud Backup services
Demystify how you can address your data protection needs in your small- to medium-sized business and select the best online backup service to meet your needs.
Forging a new future with identity relationship management
Learn about ForgeRock's next generation IRM platform and how it is designed to empower CEOS's and enterprises to engage with consumers.
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.
Internet Security Threat Report 2014
An overview and analysis of the year in global threat activity: identify, analyze, and provide commentary on emerging trends in the dynamic threat landscape.
Intelligent flash storage arrays
Tegile Intelligent Storage Arrays with IntelliFlash helps IT boost storage utilization and effciency while delivering unmatched storage savings and performance.