09 March 2008 ~ 6 Comments

Groovy is Coming…

Here comes GroovyI’ve been trying to slowly integrate some Groovy into my normal Java coding. Here’s just one of the reasons why:


Java code:
The Java code

Groovy code:
The Groovy code

Note that this reduction in complexity happens almost everywhere I choose to use Groovy over Java. Of course there are myriad other ways I could have done this in Java (I even tried Xstream but I couldn’t figure part out so I gave up). The point is that the first way I chose to do it in Groovy was natural, expressive, and easy.

Groovy is not going away any time soon. If you’re a Java developer and wish you could move faster, buy the book, read it, and then start integrating Groovy into your daily programming a little at a time. You’ll be happy you did.

And don’t even get me started on Grails

Update: here are the second and third posts in this series (benchmarks included).

Enjoyed this post? Click to get future articles delivered by email or get the RSS feed.

6 Responses to “Groovy is Coming…”

  1. Alexey 10 March 2008 at 11:24 am Permalink

    Can you provide some Java vs Groovy benchmarks for your code?

  2. jonchase 10 March 2008 at 10:57 pm Permalink

    I’m just about to post a follow up based on your question. Stay tuned.

  3. John Wilson 12 March 2008 at 4:38 am Permalink

    It can be written a little more concisely in Groovy

    def contacts = new XmpSlurper().parseText(contactsXml).contacts.collect{ contact->
    new Contacts(name: contact.@name, email: contact.@email)
    }

  4. jonchase 12 March 2008 at 8:06 am Permalink

    John -

    Awesome – thx! I’ve still got lots to learn:).


Leave a Reply