Mikhail makes a case for hungarian notation.
There are two large gaping holes in his argument:
- Naming variables a, b, c leaves a lot to be desired. Actually, as far as our team is concerned, if you would use a variable name like this in a method longer than 3 lines I would probably shoot you right away. No questions asked. Of course, you’re welcome to use ‘i’, ‘j’ or ‘k’ in a three line for loop (if there’s no iterator available).
- If methods are that long to make you wonder if a specific variable was passed by reference or value, you’re in for a major refactoring job before making any changes to the method
And don’t get me started on hungarian notation.
Well, I think it’s hypocritical to decry the use of a,b,c while promoting the use of i,j,k. Why is one OK but the other isn’t?
I never liked i,j,k for the same reason I don’t like a,b,c.. would it kill us to use at least a few characters? I would rather see “row” or “col” than “i”, for example.
Judging from my experience, using i,j,k is pretty widespread in tight for.. loops. So I would consider this OK because basically everybody knows what to expect from “i” in a loop context, especially if the notion of “rows” or “columns” doesn’t work well with the data at hand.
However, you’re right on target with using “row” or “column” as soon as you iterating over some kind of tabular data.
And while we’re at it, using iterator-objects would probably make the whole discussion moot and be a much better choice.