Ruby; A message to you, Ruby
December 7th, 2004I read as much as I possibly could in a day about "Ruby":http://www.ruby-lang.org/en/. The language is utterly fascinating, deceivingly simple, and absolutely beautiful. Maybe I'm simply jaded by the "spark" of a new relationship and will learn to loathe her in time but, for now, I'm simply awe-struck.
Coming from languages that never seemed to do the right thing the right way, it's quite shocking to me to see code that just reads and flows. When we find yourself wanting to do something, moments later you find yourself shocked to see that you *can* in fact do just what you wanted to in the way that you thought you should be able to do it.
Ruby does have a few "features" that seem… problematic. Just to give you an example, you can add methods (or anything) to a class (or anything) even after you've defined it. In addition, you can replace methods (or anything) in a class (or anything) even after you've defined it. To be more specific, you can make Ruby determine that 1 + 1 = 3. Everywhere. I believe that performing a trick like this would result in quite confusing code, at the very least. So it gives you lots of ammo to shoot yourself in the foot with. But, the fact that you *can* do it, says a lot about how the language is designed and what other things are possible.
In Ruby, everything just makes sense. When I first saw how to declare a method of a class as "private" I said, hmmm… that just looks like a call to a classes method. Sure enough, it is. Dig deeper and you'll see that you can actually CHANGE the way that works because, you can change anything.
Closures are quite powerful. I say this having never used one. Just reading about them makes me drool.
After so much digging into Ruby, I decided to "Dive into Python":http://diveintopython.org/. I've read portions of "Dive into Python" in the past, but never from "cover" to "cover".
Python is quite powerful as well. Most of the stuff Ruby has, Python has. But, after all my reading and analysis, I'm just not as impressed with Python as I am with Ruby. The *way* that Python does all of the things it does is different than in Ruby. In Ruby, it makes sense. In Python, a lot of things seem hacked.
The difference is subtle, really, and it doesn't explain itself well to produce code in both languages and compare them side by side. But, things like getter and setter methods (required in Ruby if you wish to allow users to modify object attributes), for example, just look cleaner and make more sense. The way Ruby mixins work is incredible. Ruby seems to have had flexibility and consistency as its number one design goal from day one while Python seems to have considered it after the fact.
Both languages are quite powerful. And, in truth, I'll most likely use a lot more Python than I will Ruby, because Python has more tools available to it. But I can't believe how shocked and impressed I am with Ruby. This language truly is a work of art.


















