Ruby on Rails and Grails are competing for the rapid development market amongst Java developers. Yes, RoR reaches beyond the Java community, but a lot of Java developers are experimenting with it so that is where I’m focusing this initial comparison. This is by no means meant to be a head-to-head feature showdown, but more of a general adoption comparison between the two and what the future looks like for both of them.
Grails is by its nature bound to Java and will appeal to enterprise groups more then RoR because they are more likely to have application servers already in house that they can deploy their applications to.
RoR on the other hand isn’t bound to Java and has the potential to be as common as PHP in the general web hosting arena. Already several companies are allowing RoR applications to be deployed so the trend is moving.
This really comes down to general market and enterprise market.
General Market Winner: Ruby on Rails
Enterprise Market Winner: Grails
Ruby on Rails: RoR uses the bottom up approach where you define your model at the database schema level and RoR builds the model to match using naming conventions. You don’t even have to add the properties to your domain classes as RoR will add them based on the naming conventions of the db schema.
Grails: Grails uses the model-down approach where you define your model and it (or Hibernate technically) builds the schema for you. As I mentioned I don’t like this as a matter of taste since I don’t have as much control over the underlying model. To Grails’ credit, you can fine grain control the database schema by using Hibernate’s mapping, but what a pain.
Winner: Ruby on Rails
Ease of Refactoring
Both applications are tightly bound to the data model by their nature but they approach that model in completely different ways. RoR works from the database while Grails works from the domain classes and builds the database. Both can be configured to work with non-standard (their standard) schemas however.
I tend to not like being shielded from the database for a variety of reasons, but even with that RoR is much more flexible with regards to quickly refactoring the model. One thing I loved with RoR was I can have it running, add a column to a table, hit refresh and the field appeared on the edit form page. That is nice. It even knew when I wanted a textarea instead of a text field when I change a column type from varchar to text. That is what I call ease of refactoring.
Winner: Ruby on Rails
Ruby: Ruby uses what they call Gems for libraries. There is quite a growing list, from accessing web services to command line parsing to database support.
Grails: Being that Grails is build from Java and then again on top of Spring, the list of supporting libraries is basically limited to anything written in Java, which is quite extensive. Not only does this allow for reusing custom built libraries, but utilizing the thousands of open source Java libraries out there.
Ruby: Still fairly young, the RoR community is growing like crazy. Fueled by a desire to build quickly without a lot of overhead and to some degree the FUD surrounding JavaEE, Ruby has a pretty good future.
Grails: The future for Grails is going to be a bumpy one. First they have to appeal to the mass Java crowd, which is largely going towards Ruby as it is. Then you add JRuby to the mix with its growing compatibility with RoR along with Sun’s backing and it doesn’t look quite so good for Grails. I wouldn’t count it out just yet, but it will be a hard fight.
Winner: Ruby on Rails
From the looks of it, Ruby on Rails is a clear winner. However, RoR is still young and has some growing pains to get through much like Java did in the early days. Grails has a huge step forward in that if it can really get in front of Java developers it will have a bigger impact in the enterprise much early on. RoR on the other hand, via JRuby, will be able to run on the same platform as all those other Java enterprise applications and companies will benefit from a larger Ruby user base. In addition, RoR is already showing a presence in public facing applications and adoption (see 37Signals as an example).
The other area to consider is the general small company usage. There are tons of choices available when it comes to hosting on the LAMP platform, but with the bigger hosting providers now adding Ruby to the features list I believe the number of open source RoR applications will grow quite a bit in the next couple of years and slowly push out the PHP applications that dominate the small market space. This will have a huge impact on the number of developers that are fluent in Ruby further increasing its popularity.
In five years, Ruby may very well be the next Java, even beating out Java on the JVM.
Don’t miss anything, subscribe!