By Bill Kayser (9) on February 4th, 2009

It’s not that we don’t have enough people offering opinions on what is a better language.  It’s just that some of us never tire of discussing it.  There are so many perspectives, so many arguments, and so many people willing to   spend time blogging about it you’d think we’d all be pretty sick of it by now, and I might move on to some more interesting less traveled topic, like Semicolons: friend or foil to good programming? or Extreme Programming, Acceptance Testing, and ISO 9001: Putting it All Together.

Yet I just can’t stay away, and neither can you if you are still reading this.  So let me jump right in with my take…

Ruby Doesn’t Scale.  It can’t take you to the same places Java can.

I don’t mean performance-wise.  And I don’t necessarily believe it can’t scale complexity-wise.  I just think it won’t scale with the size of a team.  I can’t see an application equivalent to 2 million lines of Java code with 80 developers written in Ruby.  Here are some reasons why:

  • the language and tools don’t facilitate writing APIsJava Books vs Ruby Books
  • it’s too hard to protect code from the side effects of other unrelated subsystems
  • the language and tools do not support for components or version management (see my posts on OSGi)
  • one bad Ruby developer can do a lot more damage than one bad Java developer
  • there are a lot of bad Ruby developers (I am one!)
  • the tests don’t scale–no Ruby app can survive inadequate tests, and the while the amount of tests grows linearly with the size of the application, the cost of maintaining them grows exponentially.  This may be true of any tests but…
  • you need more tests with Ruby–a Java app can survive without a complete unit test suite.  In fact, some large Java app can survive without tests at all.  Call me crazy but I’ve seen it.  What did we do before JUnit, after all?  I don’t think I’d want to work on one of those apps, but the point is, test code for Ruby is as essential as an interpreter to make a decent sized Ruby app work.
  • there’s no meta-programming in Java; that’s kind of a bummer, but it also means no massive indecipherable frameworks collapsing under the weight of the author’s cleverness, frameworks which are so unfathomable they are as brittle as COBOL.

There, I said it.  Now that I did, I’ll make a couple of other observations about why I love Ruby anyway:

  • A two million line Java program probably translates to 100K lines of Ruby code
  • 80 Java developers are probably as productive as 20 equivalently skilled Ruby developers
  • With only a couple of developers, I think there’s no limit to how big the application can be.  In fact, the language is much better suited for a very small team than Java because you can be so much more efficient if you know what you’re doing.
  • The tools for Ruby are way behind Java, and there’s no reason to think they won’t catch up.  When they do, it’s entirely possible the gulf between the scalability of the languages will close substantially.  I certainly hope they will.  As far as the tools for writing Ruby go, I feel like I stepped back into 2002 when I went from Java/Eclipse to Ruby/{NetBeans/RadRails/TextMate}.  rake ~ make: when was the last time I typed in make when writing Java apps?
  • The tools may be behind, but the available libraries, plugins and gems are already very rich.
  • Ruby helped me remember why I love to write programs

The last point I threw in there apropos of nothing, other than to point out that while I do miss some things about writing Java apps, I’m happy to be writing in Ruby now, and hope to keep working on it for the indefinite future, or until our app gets over 100,000 lines of Ruby which should be… never.

P.S. Here’s my favorite entry in the Ruby vs. Java debate, brought to you courtesty of RailsEnvy.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Live
  • MySpace
  • RSS
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz
  • Add to favorites
  • LinkedIn
  • MyShare
  • SphereIt

2 Responses to “Ruby vs. Java”

  1. By Atul Verma on Jun 19, 2009

    Indeed a nice blog. Well one needs to intermix different languages with different strengths – an approach Neal Ford refers to as Polyglot Programming. Choosing a development platform is never a simple choice, particularly since it usually is more of a social choice than a technological choice. Visit Martin Fowler’s blog for more information at http://martinfowler.com/articles/rubyAtThoughtWorks.html

    Reply

  2. By Angsuman Chakraborty on Aug 4, 2009

    You brought forward some excellent points. However I would beg to differ on the productivity front, especially in developing server side code. A decent Java developer backed by a good set of utilities can be extremely productive in any circumstances. I admit, the verbosity is bothersome at times, but again a good set of utilities is what does the trick for me.

    Reply

Post a Comment