How I Learned to Appreciate and Enjoy Groovy

Posted by Jim Jagielski on Monday, February 9. 2009 in Programming

As most people who know me know, I am a big fan and user of scripting languages. There are just so many places where they not only make sense, but are the only logical solution to the problem. My recent preferences have been Python and Ruby and PHP and Perl, and they've been enough. At least, up until now. At SpringSource, I and my team been working quite busily on software products, and one area which tied all the pieces together was a front-end installer and various post-installation scripts that provide additional capability. Now historically we would use Perl for these scripts, but an additional requirement was on the product: assume a bottom-line dependency of a Java JVM. This meant that Perl was out. Now of course, I could still do this in Python or Ruby (the languages) but that the implementations would need to be the Java versions (Jython and JRuby, respectively). So I could still script in one of these languages, I would simply compile them and ship the class files for the scripts (jar-ed up, of course). So there was no real problem. I did some prelim testing and was somewhat disturbed to fine that Jython was somewhat old but happy to find that JRuby was quite up to date and, from my testing, very, very robust. But SpringSource had recently acquired G2One, and so, in the logical interests of eating our own dogfood, decided to take a look at Groovy. I'm glad I did. My first mistake, unfortunately, was looking at it as a "version" of Ruby. Although there are numerous similarities, there are also enough differences that programming Groovy requires you to, at a very low level, keep your Java thinking-caps on. For example, you need to concern yourself more over actions that would cause an Exception in Groovy, whereas Ruby would just "do the right thing". In this way, I discovered my 2nd mistake: ignoring the fact that Groovy *wants* to maintain a Java-like consistency. In other words, I was looking at Groovy from the standpoint of a "traditional" script monkey, and not from that of a Java-monkey would wanted an extremely robust scripting language that removed like about 98% of the normal pain in programming in Java. When I got my head around that, then foo = new Fee() made more logical sense than foo = for example. So I've added new language to my scripting belt. And, I'll be honest here, it's made me enjoy Java programming more than ever.

Page 1 of 1, totaling 1 entries


Search for an entry in IMO:

Did not find what you were looking for? Post a comment for an entry or contact us via email!