Monday, June 7, 2010

Grails Evaluation

Recently at work, I have evaluated Grails Framework as part of larger initiative to choose a better framework that focuses on productivity gains without compromising other features expected from a good framework. Finally we chose Grails as the framework to be adopted internally for agile development. Here is why:

The published tag lines of the Grails framework are Rapidness (Productivity), Dynamic (Agile) and Robustness. While principles like DRY (Do not Repeat yourself), CoC (Convention over Configuration) and Code Generation etc provides the Rapidness; and Groovy, Scaffolding and Automatic Dependency Injection makes it Dynamic; and ultimately the fact that Grails artifacts are compiled to Java class files that make use of well proved libraries like Spring, Hibernate, Sitemesh etc. and runs in JVM provides the much needed Robustness.

On top of the core Grails library there are myriads of plug-ins (modular Grails extensions that enhance core Grails features and brings new ones to it) that brings reusable components/functionalities to Grails and greatly reduces the total effort required to create applications.

Grails has its own DSL based ORM mechanism (GORM); Controllers, Filters and Interceptors, Tag libraries etc. for Web layer; Pluggable AJAX provider; a Service Layer with automatic dependency injection and optional Java service use; excellent internationalization support with messages.properties files generated for multiple languages and convention based keys; very helpful error display where actual code snippet that caused the error is quoted; out of the box support for REST and plug-ins for SOAP web services; integration tests are created when controllers are generated; and Grails has embedded database and servlet container for development environment.

The hands on exercises that we have carried out using Grails revealed its main offering: productivity. It took no more than 10 minutes to setup the development environment, another 5 minutes to create a ‘Hello World’ application. By spending less than 30 minutes we were able to create a fully functional CRUD application (on a single entity). With the experience gained from creating these two applications, we were able to create a fully functional sample Shopping Cart application with an RDBMS within 1.5 days!!. Within 10 minutes security was enabled using Acegi plug-in.



What good a framework will do if it accompanies performance penalty for improving the productivity? Grails has no such issues, though it doesn’t provide significant performance improvement. It did work pretty reasonably under varying loads.

Adopting any new language and framework involves learning curve, sometimes it can be a hindrance. Groovy, the language behind Grails, too involve some learning curve, but relatively easy as it follows existing idioms.

Grails is a good framework that delivers what it promises and can be adopted for enterprise use. If adherence to full-stack JEE and usage of Java language is not a must, then Grails is an ideal framework that offers full application-stack features

Environment Details

app.grails.version=1.2.2
app.servlet.version=2.4
plugins.acegi=0.5.3
plugins.hibernate=1.2.2
plugins.tomcat=1.2.2
Java 1.6

If you are planning to learn Grails and use it, you will find the necessary guidelines from the various articles at Mastering Grails at DeveloperWorks

I will try publish more specific articles on Grails in coming days (lot many from others already exists though)