Groovy is Coming…
I’ve been trying to slowly integrate some Groovy into my normal Java coding. Here’s just one of the reasons why:
Java code:

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.

Can you provide some Java vs Groovy benchmarks for your code?
I’m just about to post a follow up based on your question. Stay tuned.
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)
}
John -
Awesome – thx! I’ve still got lots to learn:).