The definitive guide to Grails

You may say that Grails is just yet another web framework, but this would definitely not be fair. Even if it is a quite young web framework – being now at version 0.4.1 – Grails has learnt a lot from existing Java web frameworks but also from frameworks outside Java space like RoR , Django, etc. I would even say that the fact that Grails is based on Groovy makes it unique to the Java space and I think it may prove its usability quite immediate. These were my reasons that made me start reading the book.

Grails forms just one framework that is driving the movement toward dynamic language-based frameworks. In this sense, anyone who is interested in the dynamic language field, whether you are from a Perl, Ruby, or Python background, would gain something from reading this book, if just to acquire insight into what the alternatives are.
(Graeme Rocher)

Graeme Rocher, the Grails project lead, took the opportunity to write The Definitive Guide to Grails, so that everybody can benefit of his knowledge in developing apps and become an expert in Grails.

As the book starts, you are already told about the rationale behind Grails:

Grails definitely has an ambitious name for being the Holy Grails all application developers have sought so far. But more than having mere ambition, Grails fulfills its promises by letting you be more productive than you could have ever thought.
(Guillaume Laforge)

and a bit further:

The goal of Grails was to go beyond what other languages and their associated frameworks could offer in the web application space. Grails aimed to do the following:

  • Integrate tightly with the Java platform
  • Be simple on the surface but retain flexibility to access the powerfull underlying Java frameworks and features
  • Learn from the mistakes already made on the mature Java platform

However, it is not my intention to take away your pleasure to read the book, but just to point out a couple of things that kept up my interest while scanning it.

The book gets you started with Grails even from the first chapter where you set up your environment and the example application. It is impressive how quick things are working:

  1. downloaded the binary distribution and unarchived it in a directory
  2. configured the environment (just an environment variable)
  3. run grails run-app
  4. launch your brower: http://localhost:8080/bookmarks

All these steps and more details about Grails project, project organization are presented in the first chapters of the book. These are meant to make you feel comfortable creating new projects and handling the command line tools, but also to give you a quick introduction to Groovy.

Then the author delves into each Grails details walking you through building the domain and its persistence using GORM, creating web controllers, data binding and control flow, writing Groovy Server Pages using Groovy scriptlets and the extensive set of Grails tags.

One point about Grails controllers that I want to mention its the framework capability to define action interceptors, something that other web frameworks have proved to be a nice approach (see WebWork). Grails benefits of a large number of smart tags, some of them making usage of Ajax very easily. The Chapter 9 talks extensively about this, introducing the reader to before and after call interception, event handling, remote linking, applying effects with the help of sciptaculous JS library.

Aside of detailed each Grails Dynamic Tags, Chapter 8 is presenting the usefulness and usage of layouts and templates talking also about Layout-by-Convention.

Another thing I liked about Grails is the pagination tag, this being introduce in the same Chapter 8: Groovy Server Pages.

The last two chapters of the book are talking about more advanced topics like jobs scheduling, server-side Java integration, Hibernate, Spring, Acegi usage.

The whole book walks you through an interesting and nice app that will make things even easier to understand. All in all, I would say that The Definitive Guide to Grails was a very nice reading and I hope others will find it the same.


Leave a comment

Filed under personalog, technolog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s