views:

3527

answers:

14
+35  Q: 

Is Grails worth it?

This is half rant, half question.

Is it worth using Grails? I'm trying to develop a relatively simple database drive web applications. My expertise is in Java so naturally Grails seemed like a good choice. At first I thought of using Spring, JPA and Hibernate, but having used that previously I've ran into all sorts of tedious configuration and coding work. Grails advertises itself as solving this.

My biggest frustration with Grails are all the little things that don't work. What I mean is it doesn't work as one would intuitively think it should. It's very rough around the edges. I run into problems constantly. Sometimes it's my lack of Grails understanding, other times I've discover legitimate Grails bugs.

One major issue is the lack of good Eclipse integration. There is a Groovy and Grail plugin, but it doesn't do much other than syntax highlighting. Calling Groovy from Java and vise versa is very painful to configure. Not having good IDE support is a major bummer.

What happens is I sit down trying to develop my web application. At the end of the day I realize that I've spent about 85% of the day debugging Grails related issues. If it isn't Eclispe problems then it's eager loading, fetching in the view, one-to-many relationships, weird empty file bug behavior, weird property/getter bug, it just goes on and on. This is just a sample of the issues I ran into today. My last sit down with Grails yielded a whole bunch of different issues.

I sometimes wonder if it's worth it. I'm curious if others have experienced this. Are there people actually using Grails to productively crank out a web application? Are there other frameworks for rapid web development that I should be considering?

+30  A: 

We had a team of 12 people all seasoned senior Java devs who learnt Grails from 0.6B and we are all still working on projects based on Grails. I wouldn't go back to Java willingly, and we are all relieved to have broken the back of how to get somewhere quick with a Grails app.

It was a struggle, it was not easy and there was/is frustration.

Nevertheless we delivered something very quickly given our ongoing efforts.. There are bugs, many which have workarounds.

I have heard of several instances of developers who are good at Java trying to dive into deep, complex incantations of Grails projects. We eschewed all Java and went pure-Grails and Groovy. We made sure we started simple, built up the complexity as manageably and as practically as possible.. We dared not dive in the deepest end and hope that our Java knowledge was enough to carry us.

We had eventually created something huge and complex that worked fabulously and did so far faster than writing pure Java/Spring/Hibernate version; and thats without decent IDE support and a far worse situation in terms of bugs than today.

As regards Eclipse support, the only real IDE to use for Grails/Groovy is Intellij - the Eclipse support is way behind, sadly: I was an Eclipse lover and am far from being an Intellij convert - the Grails/Groovy support blow everything else away though.

Yes, Grails is immature compared to Spring perhaps. Or Hibernate. And I would wager that in the first 1.5 years of their existence they were equally as fraught with issue.

That being as it is, places the onus on you, to take care that you keep complexity to the absolute minimum, to carefully test-first (in our opinion) and build up to complexity gradually and with care.

There is no fast code solution with Java once you involve Spring/Hibernate in the stack. The complexity Grails embodies is a reflection of Spring's / Hibernate's own complexity. If you feel that you time is better spent doing it with pure Java, I wouldn't argue otherwise.. I still have my WTFs but now that the steep learning curve is behind me I think I will stick w Grails some more.

j pimmel
Cool. I think you decision to go with groovy only was a wise one.
krosenvold
+1I'm an Intellij user too, but I have coworkers using netbeans 6.5 happily and I've heard that eclipse support is getting much better too.We've been using grails since .5 and have been very happy with grails. There have been bumps but also rapid improvement and a great community.
Ted Naleid
My thoughts exactly and I can feel the pain as I spent ages trying to figure out the many-to-many relationships and mapping domain classes to a legacy database but with grails testing plugin and grails 1.1 it is happy days
andHapp
@j pimmel how are things feeling 18 months later?
Alison
Better than ever! Working on my 4th enterprise Grails project; employs parallelised grid-processing for large volumes of XML processing, upgrades much less painful (though yet to take the jump to 1.3), plugins getting better, IDEs very good now. At a recent meeting a .Net programmer was telling me how Grails and Groovy is one of the most unlucky Java secrets that hasn't got the attention it deserves. With SpringSource on board however the sense of our benefiting from an innovative, intuitive and evolving platform is truly upon us.
j pimmel
+7  A: 

I think Spring's support of Grails is going to be a big boost. If anybody can move it past CRUD on the web, it's those guys.

I also think it's reaching a critical mass. There are several new books that will be hitting the market in 2009. I think those will help the adoption rate.

duffymo
+3  A: 

It will be worth it when they finish the eclipse plugin. The sooner the better I say. Trying to sell groovy to my boss isn't going to be simple until that happens.

mugafuga
Eclipse plug-in? Heavens, no. IntelliJ already has excellent Groovy and Grails support. I'd recommend that you get a better IDE - IntelliJ.
duffymo
+1, but some people cannot afford to buy intellij, and is stuck with eclipse.
Chii
but IntelliJ isn't free
Steve Kuo
+9  A: 

I very much enjoy writing grails application for two reasons:

  • I don't have to use Java
  • I can use Java

I think after having become familiar with grails one gets his things done very quickly and elegantly.

So much for the plus side. The minus side is performance, which hits me on two aspects: deployment and testdriven development.

I haven't managed to run more than 3 grails applications on a single (rented) server, because I quickly hit the memory and performance limits. There are simply too much frameworks included.

Plus, the testrunner of grails isn't worth that name. When I run unit tests, they should be done in an instant, not in 10 to 20s. So I find myself all the time writing business logic in plain java, because I can test it much faster. But I guess that this can be addressed with a better integration into the IDE (eclipse).

Ole
When you say test do you mean integration tests or both unit and integration test as I am using IntelliJ and unit testing does not take that long. I would agree in case of integration tests.
andHapp
jar size is shrinking: http://thevirtualmachine.wordpress.com/2008/12/04/reducing-grails-deployment-size-part-2/, sick these in a common area or jre/lib/ext/http://www.grails.org/Testing+Plugin now comes with grails 1.1. these can mock domain objects, so unit tests run *fast*.
Ray Tayek
The testing plugin looks very cool, thanks.
Ole
+3  A: 

I was an Eclipse user before I started using Grails. It was quickly apparent that wasn't going to cut it. So I tried Intellij and NetBeans. At the time Intellij was better as far as Groovy and Grails were concerned. However, NetBeans was free and that made it good enough for me. Since then all three have had new versions or new plugins released. I am still using NetBeans because of the cost of Intellij. With the acquisition of G2One by Spring Source one of the expectations is more support for Groovy and Grails in Eclipse. This will be necessary for increased adoption.

Using Grails for a new project is wonderful. So much of the Enterprise Java baggage is no longer necessary. I can imagine trying to port something would be difficult because until you understand where a framework strength's and weaknesses are it is hard to utilize it efficiently. It is promised that JSP support will come easier in Grails 1.1, I don't know if using a beta version while trying to grok a new framework is a good idea. The testing has also gone through a major revision for the new version. If time allows you may consider waiting as the 1.1 release should be very soon.

If you have an opportunity to give Grails a try in a different IDE when starting a project from scratch I think you will see it in a different light.

Ed.T
+5  A: 

I am totally with you! Grails still feels so rough around the edges that it's almost a joke to compare it with Rails. If at least the error reporting was a little bit better. But I guess that's probably also due to the huge amount of libraries that it uses under the covers. One word: stacktrace! I am also not a big fan of the model->db approach (Rails has db->model). The scaffolding also leaves much room for improvements. Then "no restart required" also does not work as advertised. (I am not sure what's worse - having to restart all the time or sometimes finding weird behaviors that go away when you do restart) And don't get me started on GORM. (When it takes hours to find a way what would have been a simple SQL you start to wonder whether this whole ORM really saves you time) Maybe as long as it is simple.

I mean: it's still one of the better choices of a framework when you are coming from the java world. (So much useless crap out there that calls itself a web framework) ...it has potential. I just wish it wouldn't have build on top of so much other complex stuff.

Anyway - let's hope these things get sorted. At the moment I am lurking at playframework.org which also looks very slick and promising.

tcurdt
+2  A: 

Totally. There are so many Java frameworks that the bar is set quite high for newcomers, and it's a testament to Grails that it was able to rise above in such a crowded space.

It still has a few edges that are sharp, but those are just a matter of time before they're matted down, the underlying project is VERY much worth it.

hendrixski
+1  A: 

I find that the biggest advantage of Grails is that I don't have to care about the database anymore - the schema is automatically created / updated, and the persistence is largely done for me (no more writing SQL queries). This is a huge relief. The other thing that is rather nice is that once you settled on the templates for controllers and views, adding new domain objects is pretty fast. Although I suspect that you will do ongoing changes for your views at least, back-fitting them to the existing ones.

As for the IDE - it seems that IntelliJ is the best option, but I'm happy using Netbeans 6.5. I use MyEclipse for all other development, but Netbeans just has better Grails support now.

Karsten Silz
+1  A: 

I'm not sure they will ever be able to make Grails right you know. And by right I mean address all the details (small and big ones) which in the end makes it feel brittle and fragile. I'm not even sure that there is a real development team (meaning more than 2 people) behind it.

Every single time I iterate over a feature of my Grails projects, trying to improve something, it is the same workflow: everything falls apart, then it's a hundred of 'google' test cycles, then you find out the reason you can't do what you want and you do something else.

In the end, you're frustrated because you don't even want to touch anything that runs. And things that don't well, you drop them!

I'm considering a switch to Rails via JRuby. That may be the best of both worlds: a capable web framework with an active and large community, a dedicated team of developers, a platform which is not based on questionable and complex frameworks like Spring or Hibernate, a quick and ambitious release cycle. And JRuby because frankly, so many Java assets in my backpack, I can't just throw them away.

Rollo Tomazzi
There's definitely a real development team behind Grails, there's at least 4 people. Are you driving out your code by testing first? While I feel your frustration the large number of Grails success stories suggests that some perseverance is required.http://www.grails.org/Success+Stories
j pimmel
Perseverance is indeed required, as for all IT things. I've been using grails on corporate projects for about 2 years now. Each new version of Grails introduce regressions, so I'm not sure who should be testing first, and persevere ;-)Thanks for comments and kudos for your successes with Grails!
Rollo Tomazzi
Yes, I agree that handling Grails upgrades is a fairly high priced thing about using Grails.. should you decide to justify the upgrade - all our systems still work on 1.0.3
j pimmel
+2  A: 

I have just started using grails on a new project...not having to write ANY xml files yet still have the power of Spring and Hibernate is truly amazing.

Use IntellijIDEA for the IDE though, I actually discovered Grails through the IDE (I might be biased though, I hate eclipse).

+4  A: 

We are using grails + on the web layer + java with hibernate and spring on the service layer. It's the classic three layers (web, logic, data) where the web is grails and the logic is implemented in java. As is usual in java, we use bean objects that represents the data between different layers.

It works pretty well and it was the best solution for our case as the bean objects were already there, as well as the database structure. From our experience, I think grails has a great value as the web presentation layer, but I would stick with java to write the business rules and to persist the application data - as grails "is" java, all the grails-java integration is pretty straight-forward.

We use eclipse to develop the grails application and it's poor integration, as people said in here. But, as a suggestion from other developer, we run the grails application from the command-line and only use eclipse to save the source files, and it works pretty well, as the application is updated on the fly.

I yet don't feel comfortable for using grails in other places than in the presentation layer.

Ravi Wallau
This all makes perfect sense to me. This is how I intend to use Grails. i.e. for the front end.
Conor
+3  A: 

I have a lot more experience with Ruby on Rails than I do with anything in the Java world, so I'm coming in from a different perspective. Overall, Grails is much more rough-around-the-edges than Rails is, partially due to its immaturity, and partially because it relies on two insanely complex frameworks under-the-covers (Spring and Hibernate). Rails also has a much bigger community.

But, Groovy as a language has made huge strides, and is a pleasure to work with. Thanks to the improvements made in Groovy 1.6, Grails is quite a bit snappier than JRuby on Rails, and you get amazingly good XML support via GPath. There's a lot of nice features you get by being on the JVM (like concurrency and tons of threadsafe code), but without having to muck about with Java (a language I don't much care for), so I'm having a really hard time of convincing myself to use anything on MRI.

Python is looking tempting, though, I must admit.

As for your Eclipse problems, I can't help. I use Vim and Emacs, mostly because I can't stand using IDEs. For dynamic languages like Groovy, Ruby, and Python, though, I don't think IDEs really introduce any real benefit, as there isn't really any place for code generation, or a need to compile. Maybe try working sans IDE for awhile and see if things are smoother?

So, yeah, I think Grails is worth it. They've done a helluva job in getting things working as quickly as they have, and the Grails and Groovy teams are both really, really dedicated.

Don Werve
+3  A: 

I fully agree with the original posters sentiments.

We are a Java + Spring shop and took the opportunity to try out Grails. We first created a very small test application which turned out to be pretty simple to do and it worked pretty well. The main issues we had here were due to our lack of knowledge with Groovy and Grails.

Following this success (confidence boost) we decided we would attempt a slightly larger project. This has been a much more painful experience. As mentioned by others, we have uncovered all sorts of bugs and issues which were not immediately apparent on the surface. The app restart cycles get extremely painful and unless you have really good test coverage its a nightmare to do any sort of re-factoring.

Really frustrating is having code fail without a single error message! It just does not work and you don't know why?

I like the ease of use of plugins for JMS, Quartz and Remoting to name a few. Does away with a lot of tedious XML.

I almost like GORM for its simplicity though we have had several issues as well.

I don't like the loosely typed nature of Groovy and the fact that you have to run your application just to be able to catch a bunch of errors, reminds me too much of PHP or Rails.

At the end of the day we are asking ourselves if its possible to write a complex piece of manageable software using Grails...

We have a Grails application about to go into production....so we will see.

A: 

Grails might be to big for your type of application (based on the numerous files it created on the first initialization and the resources it takes). If you're looking for something simple, Grails might not be what you're looking for. If you are looking for something simple and works, so far I reckon django can do your job well. Take a look at how simple (how many files it requires) to create a CRUD apps from its tutorial. From here, your apps can (relatively) easy to scale as your needs and requirements grows.

jpartogi