Thursday, April 26, 2007

What Don't I Like About Ruby?

Back in uni a friend told me you don't really understand a technology unless you see through the hype, and can enumerate what doesn't work so well. The benefit of doing so is a deeper and more practical level of knowledge ...which was a new idea to me at the time.

I've always been a bit like a human sponge. I soak up knowledge and can do so fairly quickly - but I don't do it objectively. It's not until I go and apply that knowledge that I see the more subtle effects. I think it's really only then that I can appreciate the results of the trade-off's that every language or library must make.

These days I *do* try and examine the negatives, and it's when I do so with Ruby that I find a most interesting situation. The negatives are a side-effect of the positives.

Look at 'Dynamic typing'... often seen as a big fat negative. After all, it's static typing that makes a language more easily processed by the machine - compiler's can point out bugs & IDE's can do funky refactoring. However, without it ruby wouldn't be able to express ideas so succinctly.

How about the 'Syntactic Sugar'? It's inconsistent, right? Cryptic?

No, it let's you express what you mean in the way you think it. It allows you to write code that is easier to *read*.

...and monkey patching. The process of patching core libraries by overriding existing methods in existing classes. When i first realised this was possible, alarm bells went off in my head - core classes don't have to be sub-classed - they're *wide open*. What about the clashes? Won't libraries override each other?? How can you debug-trace that?

Well, the danger is there but doesn't surface in practice. It's generally not done unless it provides real value - and then it becomes prominent. Case in point - 5.minutes.ago returns the time 5 minute ago - Rails cool bits like this wouldn't work without open classes.

Fundamentally, Matz goal was to make a programming language that was easier for developers - not machines. Everything else took a back seat - including performance, cross-platform ideals, or even purity.

"Language is the frame of thought."

In other words, our language not only defines how we communicate with each other, it also defines how we think, what concepts we are able to ponder, and how we internalize the workings of the world in our minds.

The moral of the story - constantly evaluate your language & tool-set. It'll provide a feedback loop into your learning and hence effectiveness.

:)

1 comment:

May said...

Interesting to know.