Groovy and Grails

Greater Toronto Software Symposium 2006

Up until this conference, I was pretty disinterested in Groovy. I was even less interested in Grails, until I heard about its basis in Hibernate and Spring. Could you use Grails to do a project in a week?

I went to an introduction to Groovy by Andrew Glover (Practically Groovy). Unfortunately, at the beginning of his session, someone told Andrew that Toronto was pronounced “Torono”, which seemed to give him trouble for the rest of the session. I followed up that presentation with an introduction to Grails by Venkat Subramaniam.

A few points on Groovy:

  • Groovy can do something like OGNL. Instead of saying:

one could say
  • All Java works in Groovy.
  • There’s an Eclipse plugin for Groovy.
  • Groovy has nice string templating like Python.
  • Groovy has a “meta-object protocol” MOP that allows an object to respond to messages that aren’t part of its explicit signature.
  • Groovy has an easy SQL API too.

That was enough to get me interested in going to the Grails talk.

The big disclaimer at the beginning of the Grails talk was that this demo was like a fetal ultrasound. You get to check out that the kid has 10 fingers and 10 toes and is basically OK, but you don’t expect to have a conversation with it.

In the same way, Grails is promising, and is ready for internal use by developers (e.g., someone had whipped up a quick knowledge base for his distributed/offshore development team), but it’s not yet ready for full-scale production use.

As with Rails, you start off the application with

grails create-app

which gives you a project layout. You create a few model classes in Groovy, have them refer to each other and then run

grails run-app

which fires up Jetty and you have your simple CRUD application up and running.

A few points on Grails:

  • HSQLDB is incorporated from the very beginning, so you don’t require a real database to start doing development.
  • There’s some pretty cool built in support for AJAX.

It's only fair to share...
Share on Facebook
Tweet about this on Twitter
Share on LinkedIn

Leave a Reply