Started a Rails project recently, had been doing some stuff with Grails.
My main thing with Rails is that there's a lot of stuff that is completely opaque to the dev (which i hate), and this tends to increase when you start to add more plugins/generators/libs/etc, because in order to combine them you will need to patch something up. You get the feel that rails+plugins are just a giant DSL hack that starts breaking if you use some wrong combination of plugins+versions.
With Grails, although the ecosystem is far smaller, everything tends to be relatively consistent. The DSL approach is not very used, and by using conventional-but-boring design (I mean using classes,interfaces,etc. instead of DSLs) it's far easier to understand how the plumbing works.
Doing a 1-to-1 comparison, here's how it goes:
- Language Implementation: I prefer Ruby over Groovy, although I don't know Ruby that well. Groovy feels like a good-intention-bad-implementation language, where some of the features are welded on top of the syntax. I'm referring to some special classes that seems to be there only to allow some hack.
- Framework Features: Rails is far ahead on this one. You can configure most aspects of Rails (ex: layouts, templating, css/js packers, validation, testing frameworks, etc) in several ways. Grails is lagging on this, although its flexible enough for most use cases.
- Plugins: Rails has a ton of plugins which can be seen as a blessing or a nightmare. Some plugins are not maintained, others do not play well with some feature or plugin and there's alot of forks. I'm learning to stick with the basic and most used plugins (authlogic, haml, etc)
Grails has excellent plugins for the basics (authorization/authentication, ORM, etc) and some other plugins for smaller stuff
- Testing: Rails has a ton of ways for testing, but this is not necessarily good. Some testing frameworks do not play well with some plugins, etc. Grails has less testing plugins but again they tend to integrate better with some of the main plugins (because there aren't that many plugins to integrate)
- Database: Grails wins by far.
- I prefere modelling my domain classes instead of hacking my db.
- Hibernate (which is used under the hood) is years away from its Rails counterpart. Although there's datamapper for Rails (which is more similar in nature to Hibernate than ActiveRecord), I feel it's not mature enough. Grails also have migrations throug a plugin.
- You have great cache impls for Hibernate (JBoss cache, EhCache, etc) which can boost your performance through the roof
- Libraries: I feel that Ruby has alot of libraries for new stuff like NoSQL or Cloud services, while Java has a gazillion of libraries for older stuff like Excel processing. Don't forget that Java libraries are usually much faster than Ruby
- Cutting edge: Rails is more hype, which translates to having more resources behind it. This means that if you'r trying to integrate MongoDB or Riak with Rails, there's a good change that someone has already made it. Grails is lagging, mainly because it is not so popular so the community tends to focus on solving day-to-day problems instead of using all the bleeding edge stuff like NoSQL,etc
Here's an example:
- Most grails plugins generate code in the form of models and/or services. The rest is usually handled by a library. You can inspect the model/service code, see what it does and change it.
- Most Rails plugins usually hook up with the Rails API, which means that you end up calling some function or including some module, and then use the plugin's own DSL. This works great when it works, but when it breaks it's horrible and you end up having to patch some stuff, or install a different plugin or plugin version. I'm guessing a more seasoned Rails dev is more comfortable with this but I'm not.
Conclusion:
- If you want bleeding edge, don't mind some occasional patching, favor a large community and/or don't mind using ActiveRecord-style DB, go with Rails. Besides, Ruby as a language is very elegant
- If you favor class-interface designs instead of DSLs, prefer modelling your app through models, don't need exquisite features and are familiar with Java ecosystem, go with Grails