File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Groovy and the fly likes groovy vs grails Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "groovy vs grails" Watch "groovy vs grails" New topic
Author

groovy vs grails

Rauhl Roy
Ranch Hand

Joined: Aug 01, 2006
Posts: 401

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,
rahul.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

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.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1606
    
  13

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.

Chris


No more Blub for me, thank you, Vicar.
 
Don't get me started about those stupid light bulbs.
 
subject: groovy vs grails
 
Similar Threads
Can I read this book (Grails in Action) with no prior Groovy knowledge?
how to do an update an application
SpringSource acquires G2One
Why should I choose Ruby?
Groovy / Grails vs Java / Restful