Note: I started this article about a year ago when I learned about Ruby. I was very enthusiastic about it and and it was rather biased. Now I’ve been programming python for the past half year and finally found time to revisit this. …Now it’s totally biased. ~__-
Something that bugs me for quite a while now: Ruby or Python?
Well… Ruby still does not care about whitespace, where Python does. Typing something like “end” is really tedious and shouldn’t be necessary by now. Also Python advocates “There should be one– and preferably only one –obvious way to do it.”. In fact that’s rather compelling.
But… Ruby is just oh so elegant. It feels right. Give programming n00bs a snippet of Ruby code and they will be able to understand what’s going on. Ruby’s syntax and naming conventions rock, it reads like english; eg: current_user.is_loggedin? in Ruby on Rails*.
“I CAN HAS SAUCECODEZ?”
Python
class Bar(object):
def __init__(self):
self.reminder = "hello my name is python"
def whatYouSay(self):
return self.reminder
foo = Bar()
print(foo.whatYouSay())
vs
Ruby
class Bar
def initialize
@reminder = "ohai my name is ruby"
end
def what_you_say?
@reminder
end
end
foo = Bar.new
print foo.what_you_say?
Ruby still has some quirks, but it’s close to be teh perfect 1337 h4xx0r language.
And with the new Parser Ruby is 3 times as fast as Python. **
Python’s followers praise that there’s only one way to do it. Yes, in Ruby there are multiple ways. But there’s always one perfect way depending on the situation. The code feels so natural when you write dj.turn_the_volume_up unless dj.is_tired? instead of writing a complete if/then/else/not block. Python and Ruby produce the same Output, but the Ruby solution is beautiful.
Also: As the medium is the message and changes the communicator more than one’d expect, you’d better use a great medium.
I prefer Ruby’s beauty. That’s it for me.
If everything goes as the scientists say I’m here for approximately 85 years. What am I going to do with my time? There are many paths one can walk, but just one is perfect for oneself. When I imagine how many years I’m going to spend hacking, I’d rather enjoy them.
Or… do something else all together :).
Fin.