I have spent few years developing in Ruby on Rails. For the last half of year I have been learning Grails, too. The things described here are a summarization of the differences that I had to come over.
The comparison will be written in a simple “table based” structure. I just got used to it when preparing comparisons or product studies for tenders.
Ruby on Rails
A lightweight web framework written in Ruby scripting programming language. It contains its own application server. See the Rails home website.
Grails
A web framework written in Groovy. The source code is compiled to byte code and can be run on Java application servers. Grails home website.
Maturity
Before I start comparison, it is fair to say, that Rails has been around from 2004 while Grails final version dates from 2008. So, some of the differences are caused by this time shift.
Both of the frameworks are more evolutionary than revolutionary. They just implement the right patterns and they do it right.
Ruby on Rails | Grails | |
---|---|---|
First release (version 1.0) | July 2004 | February 2008 |
Life cycle | Mature framework with solid base of developers | Young framework with a growing base of developers and a huge base of potential developers (from Java) |
Documentation
Ruby on Rails | Grails | |
---|---|---|
Framework | Excellent. Uses the RDoc that contains not only list of methods, classes and files, but also source code of a method, with syntax highlighting. | Very good. Contains list of classes, methods, files… but I am really missing the source code. If the code is not documented, the documentation is useless |
Application | Excellent. Only the application files are documented using the RDoc (including syntax highlighting) | On one hand it is exhaustive, because it generates documentation for all classes in the project (including plugins). On the other hand it does not contain the source code. So, once the code is not documented, the documentation is useless. So, on average I would say it is good. |
Development
Both frameworks are based on flexible languages that allow meta programming – changing classes on the fly.
Ruby on Rails | Grails | ||
---|---|---|---|
Developer audience | From beginners | Some experience is required | |
Language constructs | Readable, sometimes like natural language | Readable, sometimes too many brackets (but as I said, I spent some time in Ruby :o) | |
Mapping objects to database | Excellent, all declarative | Excellent, all declarative | |
Libraries | Wide variety of libraries and plugins. Almost everything I needed was available (except for Kerberos support…) | Huge amount of java libraries could be used together with Grails. This is one of Grails killer features. | |
Scaffold | The default scaffold looks terrible, custom plugins needs to be installed. | Looks nice out of the box, implements handy nice features like table sorting. | |
Tools | rake (~make), rjs (ruby java script – library that allows to write java script functionality in ruby), migrations (tool that uses ruby syntax to change database schema – very useful) | ant (~make) | |
Log file | Very descriptive, it provides exactly the information needed: controller/action/parameters, time spent on DB, VIEW, CONTROLLER, SQL statements (including timing) | Verbose… very. Exception generated 1000 lines of code in log, missing the information about SQL statements and the things that are in the Rails log. This was a disappointment. | |
Console | Simple terminal window working in command/result mode | Window based – command answer is displayed in different frame at the end of it (unfortunately it is not scrolling properly, so it is quite annoying). I take it as a temporary problem. | |
Folder structure | Simple, follows the MVC | Following MVC, slightly more complex than RoR | |
Thread support | Poor | Native |
Production
Ruby on Rails | Grails | |
---|---|---|
Resource usage | Medium resource usage | Higher resource usage |
Potential
Ruby on Rails | Grails | |
---|---|---|
Internet | High potential. The framework allows fast development of an application with a very good performance. | High potential. It alows fast development and it can utilize all of the Java frameworks. |
Enterprises | Just for prototyping or small applications. The support of enterprise technologies is not at the focus of the community. | Could be used for prototyping and also for real applications |
Last, but not least, the popularity of both frameworks:
There are many more differences that were not mentioned here. If you find a major one not mentioned here, please leave me a comment. I will appreciate it.
One correction, Grails also provides a terminal window console which you can run with
grails shell
Hi,
I’d be glad to see deployment comparison between the too, as well as hosting.
Thanks,
Almog Kurtser
One of the main differences I see is conceptually – in Rails, you generally start with the database schema and generate domain objects, view and controller from there. In Grails, you start with the domain objects and generate view, controller and database schema. I find the Grails way more logical and easier – I believe a lot more people can write proper domain classes than proper database schemata.
I have actually done both Rails and Grails development. By “done” I mean I’ve deployed apps on both platforms.
Two of my complaints about Rails are:
1. You need to cross all your t’s and dot your i’s just to get Rails up and running with a particular database. Case in point: to get Rails to work properly with MySql on OS X Leopard you have to go through hoops
2. Rails needs to standardize on deployments. There are so many different ways to deploy Rails apps these days. Its too hard to keep track of them all and figure out which one works best without a super linux admin around.
I love both Rails and Grails. I think they both have a place.
cheers, scott.
2 Scott:
1. I did not observe major problem with database configuration and rails. I was developing on MacOSX vs. MySQL and deploying to Windows and Oracle. Some of our applications are running on Linux.
2. You are right. The deployment process is not perfect. On the other hand, our provider is doing the deployment suport and they do it quite well. (Igloonet http://www.igloonet.cz). We do the development and they do the production.
2 Graeme:
Thanks for Grails. I like it.
If you need advanced log information (e.g. you pointed out that HSQL queries are missing) you can add this to your Grails/log4j configuration. It’s up to you, but in most cases you don’t need to log *every* low level event.
You are missing quite some tooling for grails. You should at least look into gant (quite fundamental in grails), and possibly gradle, grape etc.