Monday, May 26, 2008

Reason 3: Ruby is better than Java

Mixins.

I've become very accustomed to using lots and lots of Composition in the Javaworld. Spending an Object's inheritance isn't anything to trifle over, afterall.

Ruby mixins allow for a sort of pseudo-multiple-inheritance, where you can add implementations to classes without having to subclass. You can even add the mixin functionality into existing (core) classes like Array.

Score 1 for Ruby!
Reason 2: Ruby is better than Java

Profiling.

With Java you have to use a 3rd party framework to get any useful profiling information. There are some good ones out there, but regardless, this is again a big production. Without a profiling tool, this information is next to impossible to gather.

With Ruby, you just run your program with command line "-r profile" and you get a comprehensive dump of where all the time is being spent.

Score 1 for Ruby.
Reason 1: Ruby is better than Java

The ThreadLocal concept is part of the Thread object in Ruby. Just use Thread.current["myVariable"] to access the variable.

In Java, this is a big production. Creating a ContextHolder which extends ThreadLocal and then creating a getter and setter for the value you want to keep ThreadLocal.

Score 1 for Ruby...