Grails vs Rails vs Django -- Grails wins?

The web is built on three layers:

  1. Programming Languages (PHP, Java, Ruby, Python)
  2. Web Frameworks (Cake PHP, Grails, Ruby on Rails, Django)
  3. Content Management Systems(Drupal, Alfresco, Radiant CMS, Django-CMS)

Each layer has its time and place.  Let's start with #1.  Used to be that every site was built on JSP, ASP, and PHP.  Now with web frameworks and CMS, using this layer to build a site is simply reinventing the wheel.  As a result, this layer has been relegated to (1) non-web people trying to get started via a For Dummies book (aka, don't do it!), and (2) to-the-metal, scalability-intensive sites like Google and Yahoo, built on C or Java for per-line performance tweaking.

On the other side we have Content Management Systems.  CMSs shine for sites that are common-place -- blogs, photo-galleries, shopping carts, google maps, etc.  The reason for this is that a CMS is only as good as its extensibility framework, and the more common a feature the more likely a plugin has been built for the CMS.  A CMS will get you an out-of-the-box, feature-rich, functional website in hours.  99% of websites should be built using a CMS, because its only 1% of the time you get something completely brand new -- like Yelp or Twitter in their time.  When you do need something completely fresh, a CMS is limiting because of the restrictions its framework imposes.  You end up using a lot of code, time, and xdebug to tweak a one-liner.

Enter web frameworks.  I like to think of thes layers in a "careers" metaphore.  Straight-PHP is like freelancing -- you're doing everyone's job, not getting much done, and don't have time for the tasks you enjoy.  CMSs are like government jobs -- everything's taken care of for you, but there's so much yellow-tape that you'll never push the envelope on the simplest of features.  Web frameworks are startups!  You're going to be reinventing quite a bit to get started (authentication/authorization, shopping carts, etc), but once you've got critical speed the sky's the limit with your features creativity. 

There are 4 main players on the market: Rails, PHP Frameworks, Django, and Grails (kinda in order of popularity).  I'm going to try to compare these 4 as best as I can, but I only have real experience with Rails and Grails -- the others I've learned stuff from articles and recruiters -- so feel free to chime in!


  Fun/Hype/Community Libraries/Plugins Speed/Scalability Jobs Hosting
Rails Great Great OK Many, OK $ OK
Django Meh Good Good Few, OK $ OK
PHP Frameworks OK OK OK Many, OK $ Infinity +1
Grails OK Great Great Few, Great $ SUX, $$$

 

Rails

[For coffee + mac hipsters who want to live on the edge]

Pros:  

  • Rails is the most popular web framework around, hands-down.  This means more plugins, more resources (tools, documentation, etc), more jobs (second only to PHP Frameworks), more meetups, etc. 
  • Rails hosting via Passenger is available on most shared hosts (including my favorite, Dreamhost)

Cons

  • Rails was the first popular framework of its kind, which means it has growing-pains from which other frameworks learned.  For example, it's a bitch to get simple authentication+authorization working in your Rails app, something that comes default with Django.

Django

[For linux geeks who constantly monitor htop]

Note: I don't know much about Django.  Any takers?

Pros

  • Python seems to have more mature libraries than PHP or Ruby, making it a more powerful solution.
  • As I understand it, it's more performant in the model-layer than Rails
  • A bit more CMS-leaning (what with built-in authentication/authorization, etc) than its competition, making it a more agile solution.

Cons

  • Not as popular.  From my experience, not as available of documentation, etc.

PHP Frameworks (Cake PHP, Codeigniter, Kahona, etc)

[For people who just want a job, in this market]

Pros

  • As PHP is the most ubiquitous web language, so are PHP frameworks the most ubiquitous of its competition.  Knowing CakePHP or Codeigniter is more likely to guarantee you a job, in my opinion, than any of the other web frameworks.
  • Many of these frameworks (eg, Cake PHP) are almost as mature as Rails, making them a nice medium between resource-availability and job security
  • Every shared host out there supports PHP!

Cons

  • PHP tends to pay less, from my dialog with recruiters and employers.
  • There are a lot of Frameworks to choose from, which are constantly leap-frogging eachother -- so get ready for analysis paralysis!

Grails

[For Java/enterprise gurus thinking about salary and retirement]

Pros.

  • Grails is more performant (it's compiled) and scalable (it's Java) than its competition. 
  • It tends to pay the highest and have the best job security, based on discusions I'd had with recruiters and employers, plus Indeed.com salary comparisons and Dice.com postings.  I think this is because of its Spring/Hibernate underpinnings -- an enterprisey, $$ foundation
  • I think the most important Pro is that it plugs into enterprise architecture, making it very attractive to big business.  This way you can have your cake and eat it too, by having web MVC agility & syntax sugar, without sacrificing Java/enterprise libraries, architecture, scalability, and talent.

Cons

  • Expensive to host.  Shared hosting won't cut it -- you'll need a VPS or Dedicated to sport your servlet container (eg, Tomcat)
  • Probably the least popular in this comparison -- meaning fewer jobs (though those jobs tend to pay higher).

Conclusion: I think Grails makes the most sense.  As a San Francisco resident, Rails is a must-know; so here I am, programming two projects side-by-side -- one in Rails, one in Grails -- thinking that Grails is just a shoe-in, with so many more benefits.  I'm curious what other people, with more experience in these other frameworks, think?

[Edit: sorry for the comment settings, everyone.. don't know why it was set to read-only :s ]

7 Comments

Grails: New, unproven, and fighting for mindshare

I'm not sure where you got your salary/number of jobs info from. Rails has many more jobs than the others: http://www.indeed.com/jobtrends?q=rails%2C+grails%2C+django%2C+cake-php&l=

Indeed reports that grails developers make more money, but a quick look at the underlying jobs shows that they require extensive Java/J2EE experience (which is beyond the typical Groovy/Grails knowledge necessary to build Grails apps). Basically, if your an experienced Java/J2EE developer who CAN ALSO write Grails apps - you'll make the salaries reported. If not, good luck.

One other area which you really skimmed over is enterprise integration. Ruby can be deployed on a J2EE stack, via JRuby. In fact, this is what Thoughtworks has done, building all of their internal offerings on Ruby/Rails - but deploying to JRuby and Tomcat to take advantage of the JVM.

Finally, you really have to consider the Java/J2EE mindshare/community that Grails is fighting for a place within. With so many other choices (JSF2, Struts2, Tapestry, Wicket, SpringMVC, etc) - how is Grails going to keep up? It has less than 50 contributors, and since it can only run on the JVM - it's always going to fight an uphill battle to entice the Java community over to it's side.

It's difficult to call Grails a winner (in this eclectic mix) simply because it's so new, unproven, and doesn't have the community backing that Rails has. Ruby/Rails: Proven, endorsed by people like Neil Ford, Martin Fowler, Stuart Halloway - and well tested/understood. At this point, Rails does so much more, better, and has the momentum.

3 years of Ruby/Rails at Thoughtworks: http://martinfowler.com/articles/rubyAtThoughtWorks.html
Genomes on Rails: http://www.slideshare.net/mza/genomes-on-rails-486498

(and seriously, I've not had any problems with Authentication - role based or not. That comment seems erronious)

My feedback

I am a big fan of Java, and have recently learned Grails, but I must admit, as compared to PHP for web 2.0 applications, here I feel Grails have a few downsides:
(1) Immature debugger, it is very difficult to debug in Grails, while PHP has a good debugger
(2) PHP support dynamic updates, by that what I mean is that in web 2.0 applications, the application should be live 24 by 7, so in PHP, you can easily update and add functionality without bringing down the server, while in the case of Grails, certain changes still require restart
(3) Lack of low-cost webhosting options for Grails. Which means Grails is best for enterprise, but for other web 2.0 applications, it means a high investment on dedicated servers just to launch a website.

Other than those factors, I feel that Grails is really great!

Let me try to understand

Let me try to understand this... your are trying to compare programming languages VS frameworks?

WTF? Srsly, you just can't compare a full featured framework against a plain language, it's just not fair, a framework is build on top of a language adding a bunch of librarys, APIs, best practices, etc. to the already available functions of the language.

If you're going to do a language AND a framework comparation you should take in account not only the language but also the focus of the framework, there are lots of frameworks for java: Spring, Struts, Tapestry... each one with it's own purpuse. Groovy it's not even a programming language, it's another Java framework.

And for PHP you got Symfony: agile, scalable and enterprise. There is also CakePHP, Zend and a bunch more, try using some of those before trying to rant on PHP.

Groovy is not a language???

Dude, seriously??? Groovy extends java.lang.Object. It's an extension of the java LANGUAGE. Groovy is Java and much, much more. Do some homework before publishing "WTF" statements in people's posts.

Now, along that line, Groovy is the primary language of the Grails framework, just like Ruby is the primary language of Rails. Grails also has the benefit of being able to run on the JVM. Now, Ruby can as well with JRuby, but Grails has the benefit of sharing a similar syntax as Java. This is pure speculation on my part, but I think the reason you don't see as many Grails jobs is because people are still waiting to make the jump from Java. However, it will happen. With Grails being built upon the Spring framework, it's only a matter of time before people realize what the Rails community already knows; Java is heavy and outdated. I just don't see enterprise sites dumping their java infrastructure to adopt Rails when Grails offers much less of a gap to bridge in terms of training and emotional commitment.

Ultimately, you're going to pick the right tool for the job, but when deciding which framework is going to lead the future, don't let personal biases cloud your vision. Companies are going to typically pick the path of least resistance when it comes to upgrading their stacks. In the enterprise world, this means Spring will transition to Grails with Groovy, Scala, or (I hope not) Java running the back end. I know people love Rails (I think it rocks too!), but I don't see CxO's throwing out years of infrastructure because the world thinks one framework is better than another. In the enterprise world, money talks...

You're totally right,

You're totally right, neo_rok. I was less versed when I wrote the article (sorry if I misled anyone), and I revised it since. Thanks for the feedback!

Grails is built on top of and

Grails is built on top of and is part of the Java platform meaning it's very easy to integrate with Java libraries, frameworks and existing code bases. The most prominent feature Grails offers in this area is the transparent integration of classes which are mapped with the Hibernate ORM framework. This means existing applications which use Hibernate can use Grails without recompiling the code or reconfiguring the Hibernate classes while using the dynamic persistence methods discussed above.

One consequence of this is that scaffolding can be configured for Java classes mapped with Hibernate. Another consequence is that the capabilities of the Grails web framework are fully available for these classes and the applications which use them.
Alex | Web Hosting Reviews | Hosting Coupons

asp.net

what about asp.net?

i've done my projects in rails and zend framework now for years. then i've started asp.net. i'm pretty shure after a few weeks working myself into asp.net 4.0 i won't use anything else anymore.
c# feels like a better java and the big plus is just the IDE. visual studio does everything for you!! you can focus on what you have to program and not how to do it.

cheers