• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

groovy vs grails

Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
May i know the difference between Groovy and grails.

and how the groovy and grails can be compared with java. is these technologies are alternative to Java,j2ee???

many i know more on this.

many thanks in advance,
Posts: 17347
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, there is no "vs" in that equation.

Grails is a web framework from front end to back, Groovy is a "language" that Grails uses. Grails also has GORM which uses Hibernate, and Grails also uses Spring MVC and Spring Framework. You can add lots of different plugins to Grails to use other technologies and get other features, like plugin for acegi security which is Spring security.

Groovy is a scripting type language that is very close to Java, but adds features that Java doesn't have like closures and mix-ins

The code you write in Groovy is a quite a bit less than Java, you don't hvae to import any java.util class, you don't need any semicolons.

You still use Java in Groovy, but it is slightly different. Like I said Groovy makes Java coding easier.

Posts: 2407
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rahul,

There's a good introductory video on Grails at: http://www.infoq.com/presentations/Grails-For-Spring-Developers

As Mark says, Groovy/Grails is like Ruby/Rails i.e. Grails is a web application development framework implemented in Groovy, on top of lots of JEE stuff (Spring, Hibernate etc). It's designed for the JEE platform and the standard Grails download includes everything you need to get started i.e. all the Java libraries, Groovy and a Tomcat or Jetty servlet engine. Your Grails web application can be deployed as a WAR on any JEE server, just like any other JEE web app. You can mix in Java code in your Grails application (as with any other Groovy application), or drop down to Hibernate level etc if you think it's necessary e.g. for integrating legacy DB stuff. In short, Grails makes JEE development fun again.

Groovy is independent of Grails i.e. you can install Groovy without ever using Grails. Groovy code runs in the JVM and you can use any Java classes in your Groovy scripts, so it allows you to combine existing/legacy Java code or standard Java libraries with new Groovy code in whichever way you like. Groovy typically requires far fewer lines of code than Java for many tasks. Examples: http://groovy.codehaus.org/Cookbook+Examples

Book tip: "Programming Groovy" by Venkat Subramaniam is pretty good and fairly up to date.

Also, there's supposed to be a new updated edition soon of "Groovy in Action" by Dierk Koenig, which will definitely be worth getting when it comes out. Groovy has developed quite quickly in recent years, so older books may not cover everything you can do with Groovy.


There’s no place like But I'll always remember this tiny ad:
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic