Home > Programming / tutorials > Grails – A breath of fresh air for Java people

Grails – A breath of fresh air for Java people

I’ve been working in J2ee/java technologies from 8 years and really loved it. Never wanted to switch or look anything beyond java but started working on Groovy & Grails recently, few months ago, and found that in terms of developer productivity it seems to be light years ahead of other Java solutions (spring, Struts, EJB, JSF, JSP).

What is Groovy

Groovy is a dynamic language which runs on the Java platform. It has Java-like syntax, although it’s not fully compatible with Java. (i.e. many Java programs are valid Groovy code, but not all.)Consider Groovy if you’re looking for a scripting language with dynamic language features and must deploy your applications on a JVM.

What is Grails

Grails is an open source web framework for the Java platform. However, unlike other MVC model framework-

  • Grails domain classes are automatically persist able and can even generate the underlying database schema.
  • Services and other classes can be automatically injected using dependency injection based on naming conventions.
  • Grails controllers are request-scoped, which means a new instance is created for each request.
  • The default view for Grails is Groovy Server Pages (GSP) and typically renders HTML. The view layer also includes a flexible layout, a templating feature, and simple tag libraries.

How is Grails different from java

  • Groovy is not evolution of Java but groovy compliments java.
  • Grails offers some of the best features with seamless Java, Spring & Hibernate integration allowing you to scale in terms of complexity as your application grows.
  • Groovy and Grails feel very natural to a Java programmer
  • Grails definitely has its own unique features such as dynamic tag libraries, a view technology that is not scriptlet based, the ability to use dynamic finders and persistence methods on any Groovy or Java class and its tight integration with Java, Spring & Hibernate.
  • You can develop a Grails application without knowing anything about Spring, Hibernate or SiteMesh
  • A Java development like Struts & EJB is a very configuration heavy approach, with Grails you can build an entire application and only ever have to configure the data source.
  • Groovy & Grails are very easy on the surface and allow you to be expressive and creative as a developer. They don’t, however, take away the underlying power of the JVM and frameworks like Spring & Hibernate.

Grails and in particular Groovy are very close to Java. A few quick lessons in Groovy and a Java developer and quickly feel at home.

The only real pitfall is that it’s based on Groovy and not on Java are –

  • less powerful IDE support.
  • some errors caught by Java at compile-time appear only at runtime in Groovy – this is by design and not a fault of Groovy.

Want to get started with grails ? Here is the Introduction to grails tutorial

  1. July 6th, 2009 at 15:43 | #1

    How soon will you update your blog? I’m interested in reading some more information on this issue.

  1. August 12th, 2009 at 15:25 | #1
  2. August 12th, 2009 at 15:26 | #2