A friend sent me a blog post titled Why Do the 'Cool Kids' Choose Ruby or PHP to build websites instead of Java?. He wanted my take on it, since I'm a former Java programmer and have switched to Ruby on Rails. I started to write him a response but decided to blog it instead.

The short answers is that its faster. The author of the blog claims that Java more powerful for 'middleware' logic. The sweet thing about Rails is that it largely eliminates Middleware logic. Something like 70% of the code you write in a Java web application is accessors or setters for adding stuff to the database, getting it back out, or validating it. The smart people who built RoR did all that for you. Now there is no reason someone couldn't build a RoR-type framework with Java. Maybe someone has and I just don't know about it (anyone?). I've used Spring before and it was the closest thing. But nothing I know of is as fast as RoR because so much code is already done for you.

Another important piece of Rails is that its not typed. Java is not a 'true' OO language because it has native types (int/char/byte etc). Java 1.5 did some work towards fixing that problem, but it was kind of a hack under the hood. In RoR nothing is typed, which reduces a surprisingly large amount of work. The result? Faster :)

The last point the author mentions is that Java has better tools and a bigger & better support community. I won't dispute this - its absolutely true. RoR is poorly documented and even occasionally buggy - not to mention the performance concerns. But is quantity more important than quality? Every quality programmer I know has either switched to Rails or experimented with it. That's the true reason I switched, and one of the main reasons I believe in Rails. As a further example, I know a guy who wanted to outsource a project to India. He found literally thousands of PHP developers, most of them not quality programmers. I told him to change the posting to require RoR. There are much fewer RoR programmers in India, and the ones that do know it are much better coders. RoR is a good filter for finding quality programmers :)

If you have any comments on this, join my Ruby on Rails Reading group on Goodreads!

2 Responses to “why the 'cool kids' choose rails”

  1. Kyle Brady Says:
    "RoR is a good filter for finding quality programmers :) " I'm not going to say that's not true, because I have no idea. And I will say that I think outsourcing to random people in India is a terrible idea... But, PHP != bad skills. It may appear that way because it's easier to learn as a first language when you're 12 yrs old at home on your computer, than Ruby... Another battle in the PHP v. Ruby (OR) war. --Kyle
  2. Adrian Says:
    "Another important piece of Rails is that its not typed. Java is not a 'true' OO language because it has native types (int/char/byte etc). Java 1.5 did some work towards fixing that problem, but it was kind of a hack under the hood. In RoR nothing is typed, which reduces a surprisingly large amount of work. The result? Faster :) " Well, just to be picky :) Taking Grady Booch's definition of what OO is and isn't, Java definitely IS object-oriented. So is C++, Ruby, C#, ObjC, etc. The idea is that a language is OO if it supports inheritance, polymorphism and encapsulation. Basta. But I agree with you that those "int" types in Java are really horrible. I prefer much more C# for that, where "int" is actually a "typedef" for System.Int32! Which is a real class, and as such, "int" objects are just... value objects on the stack, with real methods and such. This and many other small things make C# much more advanced as a language than Java. Finally, be careful saying that nothing in Ruby is typed: Ruby is typed, even strongly, albeit dynamically: you don't force a type on variables at compile time, but if you send the wrong message (method call) to an object, then you'll get an exception, which is the reasonable reaction and which shows up that the Ruby runtime cares about types. You can do "5.times" but try doing "5.to_yaml" and you'll get "NoMethodError: undefined method `to_yaml' for 5:Fixnum". The class is over :) by the way, I've just discovered GoodReads! Excellent work. I wish I could import my Delicious Monster database directly...

Sorry, comments are closed for this article.