Many people are pointing out that short identifier names are ok, and that i is perfectly fine as an identifier name. It likely is, and I believe the rule to be true that short
identifier names are ok for short scope / context. However, there are several issues:<p>i for an index is ok, but this is a red herring: You only ever need an i for imperative iteration and in a sufficiently high level language you are better of with selection and projection, (iteration for that matter), where you just foreach over each element and don't actually need to ask for things by index. Sure, y'all be hacking C, nothing wrong with that, it depends on what you str doing, but for comprehension, the mere existence of i is a red flag, because most of the time you want something to happen to a collection if things and foreach is perfect for that (or map, fold, filter, pick your poison).<p>Still, a better example than `i` for short identifier names would be x,y,z, or r,g,b These are so common and conventional that I would expect them to have semantics of their own, still they could be chunked to types such as Coordniate, Location, or Point, or Paint, or Color, respectively. But comming up for better names than x,y,z is really difficult, will bloat your code and make it hard to understand what is going on.<p>I am pointing this all out, because many of you seem to favor such very short identifier names - and I am with you: sometimes they make sense, see above - but empirical evidence suggests that very short identifier names, and single-letter identifier names in particular significantly worsen comprehension of code. The same is true for abbreviations (depending on how strongly you abbreviate).<p>[1] <a href="https://ieeexplore.ieee.org/document/7884623/" rel="nofollow">https://ieeexplore.ieee.org/document/7884623/</a> (disclosure: author)<p>[2] <a href="https://doi.org/10.1007/s11334-007-0031-2" rel="nofollow">https://doi.org/10.1007/s11334-007-0031-2</a><p>[3] <a href="http://compscinet.dcs.kcl.ac.uk/JP/jp040302.abs.html" rel="nofollow">http://compscinet.dcs.kcl.ac.uk/JP/jp040302.abs.html</a><p>[4] <a href="https://dl.acm.org/citation.cfm?doid=382080.382628" rel="nofollow">https://dl.acm.org/citation.cfm?doid=382080.382628</a><p>[5] <a href="https://link.springer.com/article/10.1007%2Fs10664-018-9621-x" rel="nofollow">https://link.springer.com/article/10.1007%2Fs10664-018-9621-...</a><p>Preprint for [1] here: <a href="https://brains-on-code.github.io/shorter-identifier-names.pdf" rel="nofollow">https://brains-on-code.github.io/shorter-identifier-names.pd...</a><p>[5] is the extended Version of [1] including discussion of how attention is shifted during the experiment. It turns out that, when code uses words as identifier names people don't need to read the comments as much.