Read “Code Completion,” in particular Chapter 11, “Naming.” This is a checklist (from here , free registration is required):
General naming considerations
Does the name indicate a complete and accurate description of what the variable represents? Does this name refer to a real problem, and not to a solution in a programming language? Is this name long enough that you don't need to break it? Are computed values qualifiers, if any, at the end of the name? Does the name use Count or Index instead of Num?
Naming specific types of data
Are loop index names significant (something other than i, j, or k if the loop is longer than one or two lines or nested)? Have all the “temporary” variables been renamed to something more meaningful? Are Boolean variables called so that their values, when true, are understood? Names of numbered types include a prefix or suffix that indicates a category, such as Color_ for Color_Red, Color_Green, Color_Blue, etc.? Are named constants called the abstract objects that they represent, and not the numbers they refer to?
Naming conventions
Is convention consistent between local, class, and global data? Is convention consistent between type names, named constants, enumerated types and variables? Is the agreement with input parameters consistent only with routines in languages that do not enforce them? Is the agreement as compatible with standard language conventions as possible? Are names formatted for readability?
Short Names
Does the code use long names (unless short ones are needed)? Does the code prevent abbreviations that retain only one character? Are all words abbreviated sequentially? Are names spoken? Is it possible to avoid the wrong names? Are short names documented in translation tables?
Common name problems: you avoided ...
... misleading names? ... names with similar meanings? ... names that differ only in one or two characters? ... names similar to similar ones? ... names that use numbers? ... the names are intentionally misspelled to make them shorter? ... names that are usually written in English? ... names that conflict with standard library names or with predefined variable names? ... completely arbitrary names? ... hard to read characters?
Ariel
source share