Jez Higgins

Freelance software grandad
software created
extended or repaired


Follow me on Mastodon
Applications, Libraries, Code
Talks & Presentations

Hire me
Contact

Older posts are available in the archive or through tags.

Feed

Getting Groovy

So what is this scripting language?

It's Groovy.

Yes, but what's it called?

It's Groovy.


I've been working on a small application to help automate application deployments. We have some existing infrastructure built with Ant, but it's rather clunky, some of how it works is non-obvious, and it still requires more manual intervention that I'd like.

For some time, my friend Russel has been extrolling the virtures of Gant as a build tool. Gant is a wrapper, written in Groovy, for Ant which allows Ant tasks and Groovy scripts to be combined together in one big happy build script. I'd never really understood why you'd want access to a general purpose language in your build scripts, largely because I'd never needed to. Now that I was thinking of deployments as a 'build-like' operation (even though it really isn't), the appeal was obvious. I grabbed Gant and used it to bootstrap my application.

Groovy is a dynamic language for the JVM. Unlike many other dynamic languages on the JVM, especially those that originated elsewhere, Groovy takes a 'Java+' approach. Groovy looks like Java with extra bits, which makes it very approachable. You can start quite gently, writing code that looks just like Java and become groovier over time - looser typing, list and map literals, fewer semicolons, closures, and so on. Groovy does all the normal things you'd expect from a modern dynamic language (REPL available but can also be compiled, metaobject protocol, closures, duck typing, and so on). In addition, it operates seamlessly with Java code and libraries, in both directions. Seamless is a much overused term, but here it is entirely accurate. Groovy can freely use Java classes, and Groovy can be compiled to classes which can be called from Java.

It's pretty good fun, and I'm enjoying working with it. Right now, having previously used Jython and Javascript, Groovy would be my first-choice for a dynamic language on the JVM.


Tagged code, and groovy


Jez Higgins

Freelance software grandad
software created
extended or repaired

Follow me on Mastodon
Applications, Libraries, Code
Talks & Presentations

Hire me
Contact

Older posts are available in the archive or through tags.

Feed