Good, somewhat objective summaries of the pros and cons surrounding the Ruby on Rails platform are rare. What you do find is plenty of buzz. What is Ruby on Rails all about? Why do people love it? Why do people hate it (yes, these people really do exist)? And why does it make some people very, very afraid?
Due to the nature of my employment, I’ve had the opportunity to work extensively with several web application frameworks, including Ruby on Rails. I’ve outlined my first-hand experiences below. Fat-free, but loaded with sugar.
Ruby on Rails: Development
Pros
- Very good OR/M – This is the best part of Rails. Saves a ton of work, and there is very little setup to be up and running (no nasty XML files, etc.)
- You feel like you are a hippie, rebelling against the system. J
- MVC, filters, etc. very useful
- Ruby is a terse language (compared to more tradition c-style languages), well thought-out, and very readable
- Lots of useful code generators
- Deployment is a snap with Capistrano
- Lots of interesting plug-ins and gems you can use to save time.
- Active, friendly, helpful community.
- Lots of good documentation
- Built-in testing framework
- Encourages good programming patterns
- Built-in support for AJAX
Cons
- Scaffolding is too basic to be very useful other than for learning and basic testing
- Easy to do things the “wrong way” if you rely too much on your experience with older web app models. I highly recommend getting some Ruby and RoR books and immersing yourself in the culture
- Hard to prove correctness of your code. Requires mounds of unit testing (which can easily take more time than coding the app itself).
- Large web apps become rather unwieldy. Rails is better suited to smaller, tighter code bases. Because it uses a dynamically typed, interpreted language, risk of regression bugs in your app increases exponentially with the size of the code base. Recent advancements in VMs (JRuby, Rubinius) and IDEs (Komodo, IntelliJ, Ruby in Steel), may help alleviate some of these problems.
- Hard to debug, step through code, etc. Again, new IDE support may help some with this, but it will be some time before it is on par with, say, ASP.NET.
- Rails development in a Windows environment is not as well supported as on a Mac.
- Development philosophy relies heavily on “magic” and “assumptions”. Coming back to a code base after a month or two will leave you confused until you remember everything that is going on behind the scenes.
Ruby on Rails: Deployment
Pros
- Capistrano makes deployment to multiple machines straightforward
- Runs on inexpensive *nix boxes
- Multiple DBMS’s supported
Cons
- Have to keep gems, plugins, rails library all up to date and deployed along with your web app
- Capistrano’s SSH tunnel doesn’t always work the best when deploying from a Windows box
- You will be needing multiple servers earlier than you might expect. This obviously complicates deployment, but Capistrano is a big help there.
- When the app or server crashes, Mongrel & co. doesn’t (reliably) automatically restart (mod_rails AKA Passenger may be more reliable, but it is still fairly new and not as well tested).
Ruby on Rails: Scaling
Pros
- Runs on inexpensive *nix boxes or you can use a VPS cluster
- Capistrano designed with clusters in mind
Cons
- You have to use clusters to handle even moderate traffic.
- Database can quickly become the bottleneck (this is what happened to twitter). No built-in support for multiple DB backends (shards, etc). ORM is not threadsafe.
- Eats up tons of RAM.
- Lots of CPU time spent, esp. in the OR/M layer. Much of this is due to heavy use of reflection. Rails 2.0 uses caching to improve this considerably, but can still be slow
- Rendering XML for REST/SOAP is very slow if you go through the old web services layer. In my tests, C#/WCF was at least 5x faster. Using the integrated 2.x REST features is much faster – on par with .NET when using a properly-tuned stack (not taking database access into account).
- Ruby is one of the slowest dynamic languages known to man. Ruby 1.9 is doing a lot to improve this, but statically-typed languages will always be faster. Depending on your workload, this may not matter.
- Page and partials caching can speed things up a lot, but is a pain to maintain when you make changes to your code
- Serious problems with piping files greater than a couple MB (i.e., PDFs, downloading a purchased product). I had to use PHP because Rails would crash every time.
- You have to use something else for serving static files, such as images and CSS. I highly recommend Nginx. Also makes a great proxy to Mongrel.
Ruby on Rails: The Bottom Line
Rails is a fun framework that takes a lot of the drudgery out of web programming. However, it’s lack of really great IDE support and static code analysis makes large apps difficult to maintain. There are also some serious scaling issues, even after recent developments speeding up rails 2x or so. I would recommend this for smaller projects with low to medium traffic loads. For very small projects, lighter MVC frameworks also based on Ruby would probably be more appropriate. If you are creating a web service that has to be SOAP or has to do a lot of computations or extensive data manipulation, I would stay away from Ruby altogether.
That being said, the critical weaknesses of the language and the framework (e.g., performance) are actively being addressed. So, even if you don’t choose to use Rails today, you would be quite foolish not to keep it on your radar.
Random
If you want a web application framework that *does* have a good, mature IDE, and scales better than RoR, take a look at Seaside (http://seaside.st), written in portable Smalltalk.
Cool article. Finally some neutrality.
As Andy said, finally someone just tell something that sounds real and leads to clarify decisions from business-point-of view.
I agree that “… you would be quite foolish not to keep it on your radar.” I’m not against ruby, is just that we can make better choices knowing the drawbacks in advance, and not just finding them suddenly appear in the middle of the road.
Thanks for the time of sharing your knowledge.
yvvyzp
iqyvbnr
Hugely helpful — found via asking for pros/cons to RoR on twitter and getting pointed here (nice site, BTW, will look around more.)
Since the last site I built was in ’97 using the earliest FrontPage, I was considering starting fresh and the Ruby pros sounded right for me (no baggage to overcome.) But your smart assessment and reporting gave me a clear understanding of my needs as a DIYer — thanks so much ~ !
THANK YOU for a very well written article. I’ts been hard to find objective people that just tell the pros/cons without showing a bias. Ruby appears good for the following, but it’s not the be all end of everything. AGain, very good.
I really thank you for the time taken to write this, I’m on my way to learn a new language that helps me to make wider my portfolio of knowledge but I definitively want to do it on a language that worth the study time spent in the most as possible.
As you said I rather keep it in my radar.
Glad to know this blog..cheers
That’s a con of Windows not Rails:
Rails development in a Windows environment is not as well supported as on a Mac.
That’s an interesting point of view. I was specifically talking about community support and tooling. There’s nothing inherent about Windows that the community can’t work around; it’s simply a preference that they have made to focus less on that platform.
That being said, Windows tooling and support–not only for developing RoR apps, but also for Ruby in general–is much better now than it was when I wrote this article.
For example:
http://www.jetbrains.com/ruby/
http://rubyinstaller.org/downloads/
As for actually running a Rails app in production, I would still highly prefer Linux, and I don’t see that changing any time soon.
>Cool article. Finally some neutrality.
I agree 100%, at last a blog that is objective and look at the facts… Thanks!!
Any chance of another impartial review given that this article was written in 2008 (pre-Ruby 1.9 and pre-Rails 3.0)?
+1 vote for an update.
It would be really interesting to see which of the cons you feel are inherent to the nature of RoR and which are a development stage thing.
Thanks for the original review – very helpful.
Thanks for the feedback. Some quick thoughts here:
http://nerdfortress.com/2011/08/19/ruby-on-rails-pros-and-cons-redux/
[...] I’m getting ready to start a new project using Ruby 1.9 and Rails 3.x. that will give me some good info to use in updating this old article on RoR pros and cons. [...]
Hi Kurt,
Your ‘quick notes’ update are interesting but a little fuzzy for a newbie like me, +1 vote for an update that revisits all the cons stated in this article and perhaps a new conclusion?
Thanks!
cwwtnujv