I like to be somewhat verbose with my naming. I don't like to abbreviate unless its a very common and well understood abbreviation. If nothing else because I can have a terrible memory and find myself struggling to remember exactly what a variable is storing otherwise. I can't imagine what it would be like for a different programmer entirely.<p>Perhaps I've just had to work with too much code that has poorly (in my opinion) named variables.<p>Then again I also have intellisense and autocomplete so I don't really fear a slightly longish variable name if it makes sense.
This reminded me of a previous comment (and discussion) on HN: <a href="http://news.ycombinator.com/item?id=840331" rel="nofollow">http://news.ycombinator.com/item?id=840331</a><p>"Another way to look at this: The first time you meet someone, you learn their full name. When discussing them with someone else who knows them, you use just a single name. If they're standing right there, you don't bother using their name, but just make eye contact, and maybe a "Hey". Should be the same way with variables."
Here's mine, just for fun. I haven't seen anyone else using anything like it.<p>kVariable: A constant value, even in languages that don't support constants. Usually either a semantic shortcut for some value, or for some knob that can be turned at the top of the code.<p>xVariable: A local variable.<p>gVariable: Global. (I care much more about variable scope than I do about variable type.)<p>x, y, z, i, j, k: Counters. I try not to nest or overuse these too much. If it starts to get hard to follow, then I rename them.<p>There are a couple of other hints that I leave myself too. For example, I tend to pluralize the names of variables that contain arrays or lists of things: xWindowElements for example.<p>I never cared for Hungarian notation or its brethren. To me, it just had too steep of a learning curve for too little payoff, and didn't even convey the information that I usually needed.
Why does it matter if a variable name is longer than it should be? As long as the code is legible, who cares?<p>I assume the author isn't saying that all variables should be named like "i" and "j" (and those examples are bad ones since they are well-known conventions), but that a variable shouldn't be named any longer than is needed to convey meaning.<p>Ok. Why even make this point? Programmers should err on the side of too long rather than too short. And, whenever possible, use the conventions of the language in favor of their personal philosophy.