Sunday, April 12, 2009

Getting Started with Groovy

After putting it off for a long while I decided it was finally time for me to learn Groovy.  Chris Judd gave me a copy of his book Beginning Groovy and Grails when I saw him at Code Retreat 2 here in Cleveland on the boat.  The fact that I will probably see him and Jim Shingler (a co-author for the book) at the CoJUG when I am in Columbus this Tuesday was enough motivation to get me rolling.

First of all I need to setup a development environment.  Let me see... what are my choices?

  • IntelliJ - very nice but I don't own a copy and re-installing the evaluation over and over again is not fun.
  • Eclipse - it is free but the editor really sucks.
  • TextMate - it has nice Groovy and Grails support but I am not real familiar with it.
  • Emacs - my favorite editor of all time but I'll need to add Groovy support.  I think I'll start here.
I was able to find an emacs groovy mode at the groovy site.  I chose to use Jeremy's version and added it to my emacs config



This mode provided basic language indentation and highlighting but not much else.  I guess I will be enhancing it over the coming months.  In order to pimp up my emacs for Groovy development I really needed to add a collection of yasnippets.  I modified my yasnippet.el making it aware of my new groovy-mode and proceeded to add 62 snippets covering basic Groovy and Grails functionality.  You can find all of this and my complete emacs configuration at my github emacs.d project.  Now that I finally had a powerful development it was time to move on to the language.

Since I already have a lot of experience with Ruby and Java I thought it would be easy to pick up Groovy.  My initial impression is that there are several things that feel weird - I guess I was expecting it to be more like ruby.  I know I will have a lot to say about this over the coming weeks so please stay tuned.