Why Groovy On Rails

There are many factors we need to consider before we select a framework to develop an application. Such as:

  • Easy Of Installations
  • Learning curve
  • Online support.
  • Development performance for any complex or singular tasks
  • Dependency management
  • Code performance/security tunning capabilities
  • Platform escalation/redundancy capabilities
  • Acceptance in corporate markets

There are many frameworks available for Java developers such as Spring, Struts, JSF (Seam, MyFaces, IceFaces, Richfaces), Wicket, Stripes, GWT and many more…
Before we talk about the Groovy on grails lets put a light on Spring framework which is most widely used framework nowadays.

  • Spring strongly follows Model View Controller.
  • It offers a bean auto-wiring system to replace dependency injection.
  • We need not to create object each time we can inject them using spring managed objects.
  • For model layer framework allows JDBC, Hibernate, JPA etc.
  • Of course there is a huge community around.

Now lets talk about Groovy Language.

  • It’s a Dynamic Typed Language for Java Virtual machine.
  • It’s built on strengths of Java and also it offers additional features which are inspired by Python, Ruby and Smalltalk.
  • Java developers can use this with zero learning curve
  • Increases developer productivity by reducing scaffolding code when developing web, GUI, database or console applications
  • We can integrate existing Java classes and libraries without any modification.
  • This is compiled to Java bytecode so you can use it anywhere.

Advantages of using Grails are:

Before we talk about advantages of using grails I would like to give brief introduction about Grails framework architecture.



When we look at the Architecture of grails it is built on several popular frameworks, e.g. SiteMesh, Hibernate, Spring.

So spring and Hibernate facilities come in hand if we use Grails.

Setting up of grails framework is much much easier compared to spring.

It supports Java and along with that you can write Groovy code also but internally Groovy code is converted to Java byte code from Java virtual machine.

Don’t consider this as a Java Framework its for Groovy. But Groovy has the capability to work with Java without any changes.

Groovy follows the concept of  “code less do more” where  Java is something like “Code more, do more”

Take an example :

Groovy : helloworld.groovy

        Println “hello,  world”

Java: helloworld.java

public class HelloWorld {
            public static void main(String[] args) {
                         System.out.println(“Hello, World”);

For hello world program Groovy takes a single line where as Java takes 4 to 5 lines of code even though they do the same.

Grails reduces scaffolding code their by increasing productivity.

Grails follows two fundamental concepts and expects the developer to adopt those.

  1. Conventions used by grails: Grails have set out some conventions and if we use those conventions you can be a productive very quickly
  2. Don’t Repeat Yourself (DRY): Grails itself is a good example of DRY code as we can use existing Java code without any modification. So Grails enables you to write a DRY code.

So we can say Groovy on Grails is ready cake where we can enjoy the benefits of both Groovy and Java.

The following two tabs change content below.

Chaman Shareef

Latest posts by Chaman Shareef (see all)

Submit a Comment

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current month ye@r day *