- comments are a smell of a badly chosen name!
- Only choose names that communicate your intent
- Make sure that a name says what it means, and means what it says
- When you have to read the code to understand what a name (of a method or a variable) mean, the name that you chose is bad
- Avoid special encodings in naming your variables (es: IAccount instead of Account), just use names
When naming things remember:
- Classes and variables are nouns (or noun phrases),
- Methods are verbs (or verb phrases)
- Avoid "Manager", "Data", "Info", "Data", "Handler"
- Methods returning a boolean should be named like "IsXXX"
- the longer the scope of the variable, the longer the name of the variable
- variable with short tiny scope should have very short name (even a single letter)
- the longer the scope of the method or class, the shorter the name of the variable
- i.e. private methods should have long intention-revealing and descriptive names
- functions that are called from many places should have short and convenient names
- public classes (with long scope) should have short convenient names
- private classes with limited visibility (with short scope) should have long names
- be careful: derived classes may have long names, longer that its parent class, since it may have more adjectives added