Meaning Full Names¶
Make Meaningful Distinctions¶
Do not Use like this the truly hideous practice of creating a variable named klass just because the name class was used for something else.
Use Searchable Names¶
single-letter names can ONLY be used as local variables inside short methods.
Avoid Encodings:¶
do not use encoding names because they are not esay to pronounceable.
Avoid Mental Mapping:¶
Pick One Word per Concept:¶
add method performs add a value to the list and also add two numbers. Do not write like this.
Don’t Pun¶
Avoid using the same word for two purposes
Use Solution Domain Names¶
use computer science (CS) terms, algorithm names, pattern names, math terms, and so forth.
Use Problem Domain Names¶
Separating solution and problem domain concepts is part of the job of a good programmer and designer.
Add Meaningful Context¶
Imagine that you have variables named firstName , lastName , street , houseNumber , city , state , and zip code instead of this take like this addrFirstName , addrLastName , addrState , and so on.
Don’t Add Gratuitous Context¶
If I need to differentiate between MAC addresses, port addresses, and Web addresses, I might consider PostalAddress , MAC , and URI.