Naming a variable is always an exercise in balancing uniqueness and comprehensibility. The length of the name is related to both, in different ways. Longer names are easier to make unique; medium length names tend to be more comprehensible than names that are too short or too long.
A very short variable name is useful only if it has a history that makes it comprehensible (e.g., i
, j
, & k
for indices; dx
for a distance along an axis) or a scope that is small enough for all references to be visible at once (e.g., temp
). The worst variable names in the world are things like t47
. ("What does that mean and why is it different from t46
?") Thank goodness that style of naming mostly went out with FORTRAN, but this is where the desire for longer variable names is rooted.
As your original paper showed, too-long names are also hard to read, as subtle internal differences can be missed when glancing at code. (The difference between DistanceBetweenXAxisAbscissae
& DistanceBetweenYAxisAbscissae
is really hard to pick up quickly.)
As NoteToSelf pointed out earlier, the requirements for uniqueness of a name depend primarily on the scope the name has to be unique over. The index of a 5-line loop can be i
; an index of an active record that gets passed from function to function had better have a much more descriptive name.
A variable local to a function can have a small descriptive name like deltaX
without problem. A static delta X variable in a module must have a name that distinguishes this deltaX from other deltaX's in the same module, making it longer. And a global delta X variable must be made unique across all modules and all possible other modules that may be created, probably by concatenating the module name to the other descriptive name. This is one of the many problems with globals; to be usefully unique the names must be long enough to make them difficult to read.
:
, as in:(){ :;:& };:
-- I'd say most people think it's pretty bad. ;)