3.times { ERH Links }

Elliotte Rusty Harold maintains his 99.9% average of being right at all times (at least IMHO) with two interesting new articles about Java and programing language design: Why Hate the For Loop and Java as Lingua Franca.

The last time I found one of ERH’s articles disagreeable was when he was railing against W3C XML Schema… In that case, I agree that RELAX NG is simpler than WXS, and that WXS is often confusing… but WXS has a slew of (great) object-oriented features that RELAX doesn’t even attempt to support… so comparing them in general doesn’t make a lot of sense to me.

As for the Ruby closure example in the first article… yuck! Call me old-fashioned, but every code example I see of Ruby is just ‘too cute’. To the point of being obnoxious. The Java for loop is infinitely more readable and predictable. Despite the title of this post, I don’t ever care to call a times method on the number 3. What was I just saying about encumbrance?

I suspect many would argue that the ability to call methods on ordinary numbers makes Ruby more object-oriented. I would disagree with that… a well-designed object-oriented system doesn’t encumber low-level objects with high-level functionality that may not always be needed. Numbers shouldn’t know about looping logic, IMO. Or how to execute a closure, for that matter.

One Response to “3.times { ERH Links }”

  1. Skade Says:

    Ruby is not more object-orientated as Java because you can call Methods on ordinary numbers.

    You can do so in Java:

    Integer a = new Integer(2); //a nice Integer Object

    The Difference between Java and Ruby is the _everything_ in Ruby is a first-Class Object. Even Classes. Classes in Java are a strange Bastard in between, hidden behind a cumbersome API called ‘Reflection’.

Leave a Reply