The most underrated skill.
WHY IT MATTERS
Names are the primary means by which code explains itself.
WHAT A GOOD NAME DOES
States what something is or does, precisely.
WHAT TO NAME BY
Purpose, not implementation.
WHY
The implementation changes; the purpose usually does not.
WHAT TO AVOID
Abbreviations that are not universal Single letters, outside very short scopes Names requiring a comment
Generic names: data, info, manager, handler, process
Names that lie
WHAT THAT LAST ONE MEANS
A function whose name says it retrieves something, which also changes something.
WHY THAT IS SERIOUS
Callers trust the name, and the surprise causes bugs.
WHAT LENGTH TO USE
Long enough to be unambiguous, short enough to read.
WHAT TO MAKE CONSISTENT
Terms, across the whole codebase.
WHY
Two names for one concept means readers must establish whether they are the same.
WHAT TO DO WHEN NAMING IS DIFFICULT
Treat it as a signal the thing does too much, or is not well understood.
WHAT TO DO WHEN YOU LEARN A BETTER NAME
Rename it. Tooling makes this safe.