The Curious Dev

Various programming sidetracks and shiny-object detours

Why Groovy?

When discovering that I’m a keen advocate of Groovy, people sometimes ask … “but why Groovy?”

To me, if there’s a job to be done, it shouldn’t always have to be done the same way you would’ve always typically done it, particularly if there is a more interesting and efficient way.

The Groovy language is uber-Java, without much of the ugly. It let’s you get straight to your issue of solving a problem, without having to boiler plate up some classes to compile.

With Groovy, you can just run the script.

Groovy is commonly referred to as a scripting language and is particularly attractive as glue-code scripting to fit those little tasks that you’ve probably repeatedly been doing manually. Some examples:

  • updating some configuration in a database
  • building a package of files
  • extracting a value from a database

Getting started can be as simple as writing Java-like code in a file (typically with a .groovy extension):

//saved as MyGroovyFile.groovy
System.out.println("Hello, World!");

and executing:

c:\>groovy MyGroovyFile.groovy

To make it more groovy than java-groovy, it is even simpler:

//saved as MyGroovyFile.groovy
println 'Hello, World!'

This is made simpler because Groovy imports Java’s System.out library (and many others) by default and one extra bonus: Groovy doesn’t need semi-colons!

To get started on learning a little Groovy, head over to (the home of Groovy) and grab the latest build.

The Quick Start will get you setup and then the Beginner’s Tutorial is a great place to start and you’ll be hacking up that first time saving script much sooner than you think!

Let me know how you get on.


Included file 'facebook_like.html' not found in _includes directory