Thursday, April 07, 2005

Ruby: Not quite as shiny as one would hope.

Right, what with all the hysteria surrounding Ruby on Rails , I decided to give Ruby and RoR a bit of a whirl.

I was quite disappointed with the almost vertical learning curve of Zope and quite open to abandoning Python and defecting to the dark side of the force. Matz rasping "I am your father..." after he's lopped off your hand can do that to you :-P

So any, after around a week of reading, I'm back in the Python camp and on my knees begging for forgiveness and integration back into the Hive.

What happened?

Ruby happened.

So what's this short foray into enemy territory taught me?

A. The positives.

Ruby has a lot going for it. Its OOP mechanism are much cleaner than Pythons and closures are cleaner and feel more expressive. In addition, the language supports threading, which is great. JRuby is under active development, unlike the recent history of Jython (although that's changed recently with the reactivation of that project with a fresh infusion of blood (and cash!)). The .. and ... are handle stuff sweetly in for loops too.

The community's great and the platform is still far from being fully formed, so your opinions can actually help direct the future of Ruby.

B. The negatives.

Ah, now we get to the meat of the matter. Wait, I'm going to need a numbered list for this :-D

  1. Magic variables: I left Perl and joined up with the Python camp because I hated stuff like $_, $1, $2, $foo etc. I know it's possible to avoid using these in Ruby, but not everyone's as fastidious as I am and reading this kind of code leaves a bad taste in my mouth.
  2. Crap variable names: $why $do @I have_to @@Name $my variables LIKE @this? $pare $ME!
  3. Verbose block delimiters: What exactly does one gain by using BEGIN..END versus {..} or significant indentation?
  4. Weak Libraries: One of the greatest strengths of Python, Perl, Java and other mature languages/platforms is the vast array of easily accessible libraries. It makes coding up a useful application quickly very easy. Ruby's lack of robust industrial strength packaged libraries is a major failing.

You'll notice that points 1..3 relate directly to syntax. I know the niggles seem a little petty, but things like this do matter when your coding. I want something I'm going to be interacting with for several hours everyday, to be smooth and pretty. It's something which is important to me and I'm sure to a lot of other people out there.

As for Rails... I admit that I haven't really gone all that deep into it, but that's because even a cursory examination revealed it to be heavily magical. Far too many things just 'happen' and although it may speed up initial coding, it will come back to bite you later. Besides all the squealing about 10x improvements in productivity remind me of Fred Brooks essay, No Silver
Bullet
. Some one should send the RoR cheerleaders a link.

And I've discovered frameworks other than Zope for Python.

More on that later.

Maybe...

:-)