views:

1076

answers:

4

I've worked with JSF, Spring MVC and Struts and I think I got a good level on these frameworks. Recently I heard that many good developers I worked with are learning Grails and using it in their projects.

What are the practical advantages of Grails over other frameworks? Is worth to learn it besides I know other frameworks? What is all the buzz around Grails, is it only because of Groovy?

NOTE: I did research in SO and the only related question I found was this and Grails is not mentioned

+5  A: 

BTW, Grails is not considered as a Java Framework, its for Groovy. Groovy has the capability to work with Java seamlessly, but thats the different story.

Yes, its about Groovy, and like Java its awesomely good. Groovy follows the notion "Code less, do more", whereas Java is something like "Code more, do more". No offense to Java folks, I am one of you.

You might want to read these:

Adeel Ansari
+11  A: 

Grails is, like you say, built off Groovy which gives the immediate benefit of being more productive. The Groovy syntax is much terser than Java, it's much easier to do things in one line of Groovy code that would take you several in Java.

Grails specifically provides you with a number of advantages over other web frameworks (I can only talk for Struts 1.x, 2.x and SpringMVC however) - Grails is actually built on top of SpringMVC by the way and you can integrate other components using Spring.

  • Database Migrations and Versioning - no more application out of sync with database schema syndrome. Most Java web apps suffer from this.

  • Artefacts - which make creating new controllers and components easier. No more create a controller, configure it and stuff it into the right place in your web app. doh! Scaffolding also provides you with all some initial components to allow you to start building your pages and customising

  • Simpler validation (def simpler than Struts 1.x), e.g. username(size:6..10, blank:false) specifies two validation rules for a username field to be of a specific length and non blank. It's a bit harder in the other Java web app frameworks.

  • Built in Webflow (via Spring webflow) which makes creating complex workflows much simpler. Struts 2 can support Webflow, but via a plugin which is a little odd if I rememeber. Spring can too.

  • Interceptors - SpringMVC also has these.

  • Flash scope, see http://grails.org/doc/docs/1.1/ref/Controllers/flash.html

  • Better data binding - Struts 2 is pretty good, much better than Struts 1. SpringMVC is also good.

There's a few more, check out the documentation for more details: http://grails.org/doc/1.1.1/

Jon
I didn't know it was built on top of Spring MVC. Good news!
victor hugo
Not just that, it leverages a lot from Hibernate, too.
Adeel Ansari
+2  A: 

Grails adds Groovy goodness to existing Java frameworks and provides the tooling to use it easily:

  • Grails (web part) = Groovyfied Spring MVC (like @Jon points out)
  • GORM = Groovyfied Hibernate
  • GroovyTestCase = Groovyfied JUnit TestCase

@Jon already mentioned some concrete practical advantages. I would like to point out two more fundamental concepts in the Grails approach:

  1. Convention over configuration. If you adhere to the conventions set out by Grails (which are very sensible btw) you can become productive very quickly.
  2. Don't Repeat Yourself (DRY) Grails enables you to write DRY code and in itself is a good example of how to be DRY. If you have any existing Java code reusing it in Grails should be no problem.

So,

Is it worth learning?

I think for you yes. Since you already know Java and some of the available frameworks (especially Spring MVC) the learning curve should not be steep at all.

What is all the buzz around Grails, is it only because of Groovy?

The buzz could be explained because Grails demonstrates that Groovy can be leveraged to create a very usable "product".

Heinrich Filter
I started reading Grails guides as soon as I knew it was based upon Spring MVC ;). You set good points here, thanks
victor hugo
A: 

Tapestry rocks. Object-oriented framework which matches OO language. Its nice to be able to stay completely in the same OO mindset.

I always found the "request" frameworks to be awkward at best. And dangerously bad at worse (developers tend to get wrapped up in the mechanics of the request).

We are using Tapestry 4 but will be upgrading soon.

Pat