Usually it's people who come from math backgrounds. They are very used to, and comfortable with using single letter symbols to represent everything. I would always notice it back when I was in school, and the math teachers would have some programming project, either a framework for us to use or a sample or whatever. It was always single letter stuff. While frameworks and samples from programming or game projects teachers, they would use descriptive variable names.
Ugh! Your shorthand is too short!
The more annoying thing aboug one-letter variables is about highlighting or finding them (pray you do not have to refactor such code), not so much about understanding what they mean (if the programmer is only somewhat sensible, the purpose of one-letter names is usually still obvious).
But once you find out that your editor lets you conveniently highlight all occurrences of greater-than-N substrings (usually N=3) you start shouting at people who use one-letter variables because it doesn't work with the default settings, nor is there a way you could configure it so it works in a usable way without highlighting every frequently occurring letter in every keyword too.
Well, that's only an argument for getting a better editor. If your editor does not find or highlight single-character variable names out of the box it's already broken.
I was trying to learn about b-trees, and so I looked around and found this implementation, full of one letter variable names:
then one thinks for a moment "hey, this is where C could use a more powerful preprocessor"...
then thinks for a moment more "I already wrote one before, it didn't help all that much, was inconvinient to use, and generally ended up not really used much...".
but, yes, sadly I have done this sort of thing before, just not usually this much at once, in a few cases (typically for statically-typed interpreter logic and similar, where basically otherwise similar logic has to be repeated endlessly for N-way combinations of types).
Use longer names instead of single letter variables. Consider replacing
a with alpha
b with beta
d with delta
etc.
I do hope you are being sarcastic
I do hope you are being sarcastic
Nope. I do the same with indexes:
i with idx
j with jdx
k with kdx
I do hope you are being sarcastic
Nope. I do the same with indexes:
i with idx
j with jdx
k with kdx
Indices.
And it's not very object oriented is it?
Consider replacing with
int GetIndex(int idx) { return idx; }
Indices.
Okay.
And it's not very object oriented is it?
Consider replacing with
int GetIndex(int idx) { return idx; }
Ah yes, that's from a factory created from the DecimalSystem.GetArrayAccessorByIndexFactoryCreator(), isn't it?
I like the way you code reviewed your edits ;)
I am being sarcastic in case noone noticed.
I was trying to learn about b-trees, and so I looked around and found this implementation, full of one letter variable names:
THE HORROR.
To the eye of someone who has done years of maintenance programming,and looked at microsofts various SDK samples (and looked at peoples code on this site's forums), that is trivial.
There is the opposite problem of long variable names smearing code statement across multiple lines