Tuesday, February 12, 2008

This year will be Groovy

One of the things that I wanted to accomplish this year, was to learn a new programming language. There are so many different languages that now are able to run on the JVM, that I didn't know exactly where I would focus my attention.

Originally, I started out with the idea that I wanted to learn Scala. One of the main reasons why I wanted to learn Scala is because it is a functional language. I have never worked with a functional language before. I was interested to see if solving problems in a functional manner, would inspire me to approach problems in Java differently. I downloaded it and started to go to the different tutorials online. To be honest, I was a little intimidated. The syntax is very different, and I don't think that I would be able to spend the amount of time necessary in order to get up to speed with this language.

The next language that I considered learning was JRuby. Of course, everyone has heard all of the hype around Ruby. However, I was more interested in learning more about JRuby because I have a ton of Java code / experience that I didn't want to lay waste. With JRuby, it is possible to use all of the fun Ruby syntax, but not have to give up your Java code / experience. Ultimately, I decided not to spend time looking into this language either. I think that I am still interested in picking this up in the future, but now I am even more interested in....

Groovy. I like Groovy. I like Groovy, a lot. One of the main reasons why I like Groovy so much, is because I have just started using it, and already I have been able to apply it to solve real customer requirements. We had a need to generate XML files based off of a Database query. Now, you can imagine how much Java code would be necessary in order to accomplish such a feat. By leveraging Groovy's integrated Sql features together with their Template approach, I was able to solve the problem very easily.

Another reason why I enjoy this language so much is because it was built with integration with Java in mind. If you cannot think of a Groovy way to get a task done, you can always import a Java class and use it. I didn't know the best way to format a Date in Groovy. However, in Java, I know that I can use the SimpleDateFormat. So that is what I did. I imported it at the top of my Groovy script, and used it. Simple.

What are you learning new this year?

No comments: