Naming Accuracy
Variable names must be accurate to successfully communicate understanding to readers. If a variable name doesn’t accurately reflect what the variable is supposed to represent, something might be communicated to a reader, but it won’t be what the code is doing or intended to do.
Inaccurate variable names can communicate no actual understanding or wrong understanding. Neither is good, so aim to make your names accurate. Articulate what the variable represents in words (either out loud, in your head, or written down), and then use those words as the basis for a good variable name.
The following sections contain more specific tips on what to do or not do when it comes to variable naming accuracy:
- Don't Use Unrelated Variable Names [VA1]
- Double-Check Variable Name Accuracy [VA2]
- Precisely Identify Boundary Conditions [VA3]
- Include the Primary "What" in the Variable Name [VA4]
- Distinguish Between Singular and Plural Data [VA5]
- Distinguish Between Different Kinds of "Fractional" Numbers [VA6]
- Fully Represent Multi-Part Values in Variables [VA7]
- Name At the Right Level of Abstraction [VA8]
, multiple selections available,