Monday, April 27, 2015

Mythology

Soroush Khanlou:

In one of my favorite posts of all time, Mike Hoye looks up exactly why we use zero indexed arrays. To spoil it, he finds that it was to optimize for compilation speed (rather than execution speed) on hardware where you only had a limited time to run your job.

[…]

Why has MVC attained this state of reverence when it’s trivial to find cases where it doesn’t apply? And it’s not as though MVC is a mere suggestion: the Cocoa documentation actually states that every object has to be either a Model, a View, or a Controller, even though there are objects within Cocoa that don’t even fit in one of those three categories! “MVC” isn’t a rigorously-defined term anymore, but rather a necessary, low-information signal to other developers that our new framework fits into their worldview.

[…]

C-style syntax probably will never go away as long as we have text-based programming languages. Even Swift, which tries to fix tons of flaws in programming, doesn’t even begin to move away from C-style syntax. It’s too ingrained in the way we view code.

[…]

It’s too easy to continue doing what we’ve always done. I want to question all the constants in my programming career. The things that are already status quo are don’t need cheerleading: they’re already winning. But the weird ideas, the undersung ones, those are the ones we should be championing.

Previously: Why Array Indices Start at Zero. I find Hoye’s post interesting but not entirely convincing.

1 Comment RSS · Twitter


Hoyle's "Why Array Indexes Start at Zero" seems to be missing the point. In programming there are some choices that are conventional and some that are natural. It turns out that semi-open ranges and zero-indexing is just a more natural choice for digital computers*.

This choice has not come to dominate programming languages because it made compilation faster on the IBM 7090. Rather, the choice is a natural one and making for a faster compiler is just one of the consequences.

I do admit that the choice feels unnatural, but I think that is largely because we are taught the wrong convention in elementary school. I'm sure decimal notation seemed unnatural to those schooled in roman numerals, but that doesn't make it the wrong choice!

* as discussed by Dijkstra in a paper Hoyle references as "hippie voodoo nonsense".

Leave a Comment