Is Grails (now) worth it?

2019-01-29 18:50发布

I know this is a duplicate, however, the Grails world has moved on considerably since that question was asked more than a year ago, as has the IDE support in Eclipse, so please don't just blindly close it.

I thought the answer was yes and have embarked on a new project with Grails 1.2.0 and have flirted with the Groovy/Grails bits of the STS Eclipse Integration.

I think the question deserves revisiting after a year of Grails evolution, when the answer was definitely mixed.

So, as an experienced Java web developer I have these questions and would appreciate my assumptions being challenged:

  • Is Grails now worth it vs. Ruby or roll your own?
  • Has it overcome its buggy start?
  • Does it really confer rapid development benefits? (I admit I am struggling now I am past the extensive baseline configuration to make my bespoke app which is not list and page oriented)
  • Does it perform for real world production apps? (It feels heavy)
  • Is the Eclipse plug-in better than it was and fit for purpose? (I think not yet)

Thanks

EDIT: I am learning as I go and I have a couple of significant gripes to make about living with the framework - rather than framework capabilities themselves. I am adding these because I think they should be considerations and are based on my experience and opinion, and may help someone who is trying to decide whether to go grails. I may also be showing my lack of experience with the framework, so none of this is meant as out and out criticisms. I am an experienced developer and this is what I have found:

Debugging is really hard. In fact it is almost impossible, especially as a beginner in the framework, which is when you need your trusty debugger friend the most. I have spent way more time than I ought to tracking down problems of syntactical errors in some part of the code to do with referring to domain fields which cause silent failures somewhere in the stack.

Logging is frankly awful. You have two modes, "nothing useful" and "an inordinate amount of useless stuff". My debug log was 128Mb after a single page request and contains nothing about my error. The whole issue of logging needs reconsideration in the framework in my opinion.

The STS Eclipse IDE is of marginal value. Other than syntax hilighting it is not much use. You can't debug the code so it is a glorified editor. The code hints are patchy and there is no GSP support at all as far as I can see. It also is the slowest Eclipse plug-in I have on my desktop - by about 2 minutes to start up. It is shockingly slow. I have reverted to a text editor (which you'll notice all the online tutorial videos do too) and some custom syntax hilighting.

I have some serious concerns about performance. A bit too early to say, but I am already finding myself tweaking the database because of hibernate. Perhaps that's to be expected, but I am really having to keep my domain model simple for the conventions to yield performant queries.

And one last one, the convention that your logical domain model and your physical database model should be identical is not a smart default and unlikely ever to be the case in the real world. I know you can separate the two, but it creates a degree of complexity which I think could be avoided if the conventions were extended. There is inadequate documentation about composition and what you need to do to make it work in practice.

21条回答
等我变得足够好
2楼-- · 2019-01-29 19:26

In my experience, Grails bring a few very attractive features on the table which definitely makes worth learning and using it.

  • Agility - things we used to take weeks to implement in conventional J2EE projects are generally a day's work with grails plugin system. Things like ajax, jquery ui, acegi, restful implementation, scheduler system and lots of them
  • Runs on JVM which alleviates need to learn some other run time system and its idiosyncracies
  • Java like syntax and groovy syntax sugar. like best of both the worlds. You can immediately start with Java instead of learning syntax of new language like Ruby and then slowly you can move to groovy syntax which is robust, easy and intuitive

    For the project managers, unless there is compelling reason for "not to use" grails for some reason( resistance from higher up, to adopt new technology or something), I don't see any reason why grails can't be used or at least tried.

To answer the concern about debugging, it's not that hard. Debugging is easy if you use Netbeans IDE. That brings me to one more point to mention. After few experiments with all the IDEs we found that Netbeans is the most suited to do the job. It has better support for code completion, syntax highlighting and debugging etc. In my opinion, STS is not good enough for that.

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-01-29 19:27

Has it overcome its buggy start?

It's still horrible. I do not know their start, but migration from Grails 2 to Grails 3 is still nightmare and they are breaking more than they solve.

Does it really confer rapid development benefits?

I spent one hour making Grails' tests to output something in console(it doesn't work out of the box), even in Java you will not spend such amount of time to output something from tests.

Does it perform for real world production apps?

I still do not know a single famous company who is building something with Grails.

Is the Eclipse plug-in better than it was and fit for purpose?

I've no idea why anybody's still using Eclipse, but IntelliJ support for Grails 3 is just unusable.

So, answering the main question:

Is Grails (now) worth it?

If you can not afford the Microsoft Access license, maybe. For real projects I would stay away from Grails. It's just a stillborn child, in fact.

查看更多
劫难
4楼-- · 2019-01-29 19:27

I have yet to find someone who is expert in both Grails and Rails and prefers Grails.

If you know both well, then you almost certainly prefer Rails.

Grails typically appeals to Java developers who fear platform change.

In this case, I think JRuby is probably a better way to adopt an agile approach on the aging legacy jvm.

查看更多
小情绪 Triste *
5楼-- · 2019-01-29 19:28

I want to point out to two more considerations, memory usage and job market. Grails application takes a lot of memory especially in development mode e.g. 600 Mb for a medium sized application. When deployed in production mode, e.g. war file in Tomcat, the usage can be about 500 Mb. This is partly inherited from using Java.

As for job market and as far as I have read, there is little demand for Grails programmers in job vacancy announcements compared to e.g. Django and Ruby on Rails.

查看更多
女痞
6楼-- · 2019-01-29 19:29

Personally, I learnt RoR and used it for a few home projects, but then switched to Grails, mostly because it runs on the JVM and therefore I am hoping to make use of the plethora of Java performance/profiling programs, which should help identify any bottlenecks in code before they become a problem.

In general I haven't found too much difference in the quality of IDE's used by RoR vs Grails. Although, to be fair, I'm programming on Linux and haven't tried TextMate for RoR development. When I was using RoR I used Netbeans.

Right now I am programming using STS and am finding it a pleasure to use with Grails, although I still find that method detection/completion could be made to work much better.

查看更多
不美不萌又怎样
7楼-- · 2019-01-29 19:31

Regarding the eclipse plugin, is still coming its way, but you can use the eclipse version from Spring Source (SpringSource Tool Suite)

http://www.springsource.com/products/sts

It's quite decent compared to the previous plugin versions, and since Spring Source has acquired the company responsible for grails and groovy, you can expect that STS will become better quickly

查看更多
登录 后发表回答