logoalt Hacker News

DanHultonyesterday at 4:13 PM2 repliesview on HN

Xyz makes sense because that is what those axes are literally labeled, but ijk I will rail against until I die.

There's no context in those names to help you understand them, you have to look at the code surrounding it. And even the most well-intentioned, small loops with obvious context right next to it can over time grow and add additional index counters until your obvious little index counter is utterly opaque without reading a dozen extra lines to understand it.

(And i and j? Which look so similar at a glance? Never. Never!)


Replies

jonahxyesterday at 5:07 PM

> but ijk I will rail against until I die.

> There's no context in those names to help you understand them, you have to look at the code surrounding it.

Hard disagree. Using "meaningful" index names is a distracting anti-pattern, for the vast majority of loops. The index is a meaningless structural reference -- the standard names allow the programmer to (correctly) gloss over it. To bring the point home, such loops could often (in theory, if not in practice, depending on the language) be rewritten as maps, where the index reference vanishes altogether.

show 1 reply
kaibeeyesterday at 4:23 PM

ijk are standard in linear algebra for vector components.

> (And i and j? Which look so similar at a glance? Never. Never!)

This I agree with.

show 2 replies