Select Page

My Thoughts on Grails and Groovy

Getting Started with Grails

I’ve been using Grails for developing web applications for a while and in this post I’m going to give an overview of Grails and provide some of the benefits and disadvantages of I’ve come across when using it.

Grails overview

Grails is a web framework based on Groovy and Java which can be deployed onto web servers such as Tomcat or Jetty.

Grails follows the convention over configuration concept that Ruby on Rails has made famous. It provides a command line interface and code scaffolding that allows you to create a full application quickly.


If you haven’t used Groovy before the best way to describe it as being a superset of Java; most valid Java constructs are also valid Groovy constructs. Groovy has a number advanced features that complement the capabilities of Java, the syntax is more concise, you can use closures, and there is native support for lists and maps

Grails benefits

  • The primary benefit is that Grails is a highly productive framework; the emphasis is on being able to automatically create artefacts quickly from the command prompt.

For example grails create-controller creates a new controller and automatically does all of the plumbing related to that controller. Even more powerful is the grails generate-all, which creates all the artefacts and interfaces for performing CRUD (Create/Read/Update/Delete) for the domain specified.

  • Grails also underpinned by solid frameworks – it uses frameworks such as Spring, Hibernate (uses GORM which is based on Hibernate) and Sitemesh which are very mature and established frameworks.
  • Another important benefit is that Spring Webflow is also built in to the framework – which helps make complex workflows a lot easier to handle.
  • Validation is straightforward in Grails; the rules are defined within a static code block within the domain class.
  • There is also a very rich plugin ecosystem with Grails – it was built with plug-ability in mind and there is a large set of useful plugins that have been created by the grails community. It is also very easy to use these plugins within your own application using the install-plugin command.

Grails Disadvantages

  • There are not many real issues with using Grails, however one of the main things to bear in mind is that there is a learning curve associated with using Groovy, so that may make it more difficult to recommend to your colleagues.
  • There is also slightly less IDE support for groovy – especially in comparison with developing a vanilla Java application using them.
  • A grails application can also be a bit of a resource hog – which can probably be attributed to all of the heavyweight frameworks that Grails is made up of.
  • One of the problems using a dynamic language such as Groovy is that some errors that are normally caught at compile time with normal java will be not be caught until run time.

Grails in Action

My favourite book on grails is Grails in action. It is very well written and the authors seem to have a genuine interest in development.

Final thoughts on Grails

I have enjoyed using grails on my last few projects – there was a learning curve at the beginning but the rewards more than make up for that. I will be looking to using it on future projects and would definitely recommend it to other developers.


You May Also Like…


Submit a Comment

Your email address will not be published. Required fields are marked *