The Psychology of Quality and More
CHAPTER 5 : Naming
5.5 Spelling of names
The way words are spelled can cause several types of problem.
A dangerous practice when naming items is to use spelling (or case) variations, such that when spoken, two names sound the same:
FlangeType, FlangeTipe, FLANGETYPE
Names should always be spelled correctly; there should be no alternative spellings of the same word. You should be able to write the name down from the pronunciation. Kernighan and Plaugher describe the 'telephone test', where it should be possible to read the code over a telephone, and a listener at the other end (who knows the standards used) will be able to write down the code correctly.
This is a problem where there is one name that would be natural to use for several different items. In this case, the name must be 'awarded' to the item which will help most the understanding of the code. Typically, this will be the item with the widest scope (eg. a common structure, rather than one instance of it).
A similar hazard occurs where two names may be distinctly different, but where the spelling of both words is similar (and even more so when the difference letter is of similar shape). This is something that can happen accidentally, but cause subsequent confusion:
LastWord, LastWard, LostWard, LostWand, LastWind, EastWind
Names which differ by only one letter can even be mistyped into the similar name, especially if the differing letters are adjacent on the keyboard. Similar error can occur where a singular and a plural name both exist, especially where the plural is formed by adding an 's' to the singular. A simple solution is to use names which differ by at least two characters, although this can cause problems where natural names are similar (e.g. describing a person with Height, Weight).
Another potential source of confusion is to give a local variable the same name as a global variable (or, for that matter, any variable with a wider scope). The global variable is now, of course, obscured and any assignation to it will be redirected to the local variable.
Initial and trailing underscores are commonly used by compilers and libraries for special purposes, and it is thus a good idea to avoid strange problems by not starting or ending symbol names with an underscore:
Double underscores should similarly be avoided, for the above reasons, plus the fact that many printers will not show the space between them (thus they appear as one underline):
Numerals in names can be confusing, as they can look like letters, and should thus be used with care. Even if they are clear on your terminal, they may not be on someone else's:
AB10S, A8IOS, ABIOS, ABIO5 or A8105 ?
And the big