After spending the last couple of weeks tinkering with Groovy, I figured it was time to have a closer look at Grails to see what it had to offer. I’ve gotta say that my first impressions are very positive.
First of all, the user guide has increased out of sight - with tons of coverage on the stuff you want to know about (how controllers work, dynamic tag libraries, ORM integration, all very cool). Follow the quick start and you’ll be up and running very quickly. Be warned, you really need to know a little Groovy before you embark on this journey otherwise a lot of things won’t make much sense to you. Just the essentials: closures, groovy beans & collections will probably get you started.
Grails uses Hibernate under the covers, and if you’ve worked with Hibernate before, you’ll be pretty comfortable with the conventions. "One to Many" operations are a snap - inside your Order class declare your "Set lineitem" then use a "def relatesToMany = [ lineitem : LineItem ]". If you want to make navigation bidirectional, "def belongsTo = Order" in your LineItem and you’re off.
In the hour I had this arvo, I’ve managed to get a small app doing bidirectional mappings between four domain classes. Using the standard controllers (you get basic CRUD controllers for free without a line of code), I’ve got things persisting to my Postgres database, with the schema generated for you by Grails on the fly. Geez.
I haven’t done any work with Ruby on Rails (Matt is doing a tail on this at our next CJUG), but I guess this is the kinda thing that people talk about when they say that dynamic languages can really help shorten development cycles.
Will write some more when I’ve had more of a chance to tinker…