What’s Wrong With Ruby?
”I did not find Ruby particularly ’elegant’, or its syntax particularly obvious. Much of it seemed ad hoc, thrown together, in particular when there were several different ways of doing something, and it seemed to be the philosophy of the language to provide all of them. I did not find its constructs as intuitive and natural as claimed, trying out simple coding examples proved as frustrating when things didn’t do what you’d suppose they’d do...”
If I tell you that these are the views of a newcomer to Ruby, you might think they can be dismissed as the babblings of pure ignorance. Not so! The quote above comes from an article by Matthew Huntbach, a lecturer in computer science at Queen Mary, University of London. I first came across Matthew after her wrote a feisty and well-argued riposte to a piece that Dermot Hogan and I had written about Object Orientation; in his comment, Matthew happened to mention that he was just starting to take a look at Ruby, that he was suspicious of all the hype that surrounded it but since “there are people who I’ve admired in the past who are going for Ruby,” he thought “there must be something in it.”
It struck me that this would be the perfect opportunity to get the opinion of a highly experienced computer scientist with no axe to grind pro or con Ruby. I asked Matthew to take a closer look at Ruby and write an article giving his views on what he found. I didn’t know whether he’d end up loving the language or hating it. In the event, Matthew seems to have found things both to like and to loathe about Ruby. On the plus side, he says…
“If I needed to use a scripting language, it’s the one I would now use. It’s cleaner than Perl, and I like its syntax better than Python.”
But his praise is certainly not unqualified. He believes many of the claims made for Ruby are ‘outrageous’ and is highly sceptical of the benefits of Ruby’s core features such as its ‘dynamism’…
"Ruby’s dynamic class modification also strikes me as something with the potential to produce hugely complex and non-understandable code. If I am tracking down the source of some buggy behaviour, I might start by looking for the class of the object whose method call led to the bug. The lack of types in Ruby would make that more difficult, but on top of that I have to face the possibility that the method may have been redefined somewhere else during code execution, maybe for the whole class, maybe for the individual object. There isn’t one class definition I can reliably say completely defines an object’s behaviour…"
Prof. Huntbach learning Ruby in order to evaluate it strikes me as ridiculous. Without a context, you can’t pass judgment on any language, and even then it is largely a matter of programmer prejudice. Similarly, he had a link to a blog post on giving programming tests and I don’t think I would hire the poster or any of the commenters, regardless of their ability to do ridiculous algorithimic exercises cold. That just makes smug, small-minded code monkeys who think they know best. Prove that you have successfully solved substantial real-world problems and I will hire you.
From one old SmallTalk dude to another...
Ruby is just one of the latest combatants on the battlefield of the ’My Language is better than yours’ war. This war has raged for years with no one language ever gaining any real strategic advantage. The war will never be won.
I use Ruby for things it is good at. And I use C for things it is good at. And Pascal...and C#... You get the idea. Every language has strengths and weaknesses. I would never use Ruby for embedded programming...and no sane Ruby promoter would either.
At the end of it all...choose the language to suit the job...and be happy.