I'm going to start with this table so it's all up front.
(Widen your window if the CSS float sidebar is overlapping the content)
Lines | Characters | |||||
---|---|---|---|---|---|---|
C#/ASP.NET | Ruby on Rails | Ratio | C#/ASP.NET | Ruby on Rails | Ratio | |
Display | 13,623 | 6,372 | 0.47 | 753,538 | 219,501 | 0.29 |
Non-Display | 49,017 | 10,131 | 0.21 | 2,238,702 | 331,877 | 0.15 |
TOTAL | 62,640 | 16,503 | 0.26 | 2,992,240 | 551,378 | 0.18 |
When I started working in Ruby and Rails back in 2005, I was mostly a Java and Struts developer. I had spent years messing with XML and type-casting and fighting logic:equal tags and building Iterators - not to mention hand-crafting my own pre-Hibernate object-relational database layers. Using Ruby on Rails felt like someone had opened a window and let in sunlight and fresh air. Things that would take dozens of lines of Java were reduced to a single line of Ruby, and entire application layers just disappeared.
I had always wondered exactly how much more efficient Ruby on Rails could be over Java and Struts, but I never had a direct translation of an application to work with.
Last fall I worked on just such a project, converting ClearFit's application from a crufty old .NET/C# application to Ruby on Rails. We kept the same screens and the same functionality - just cleaned things up and translated everything into Rails. This was a perfect opportunity to get some real numbers on how much more efficient Ruby on Rails can be compared to a Java / C# application.
I gave a presentation in early May and this was one of the more popular slides:
So, in general, a big Rails application will get the same thing done as a big C# app in roughly one fifth of the amount of code.
Since there are lies, damned lies, and statistics, here are some mitigating factors (in both directions):