foundation

Naming

Choose names that expose domain meaning, units, lifecycle, and responsibility instead of abbreviations or implementation trivia.

Names communicate domain intent, units, lifecycle, and scope. Prefer `retryFailedPayment` over `handle`; `elapsedMs` over `time`; `isPublished` for booleans. Consistent vocabulary across modules beats clever brevity. Rename when understanding improves—modern IDEs lower the cost.

Bad names hide bugs: `data`, `info`, `manager`, single-letter outside tiny loops.

On interviews: improve a vague function and variable set and explain how names aid code review.

Common pitfalls: Hungarian notation noise, abbreviations unique to one team, and names mirroring type (`userArray`) instead of role.

The trade-off is longer identifiers versus comprehension speed for new readers.

Checklist:

  • Names reveal domain action or concept.
  • Booleans read as questions.
  • Align terms with ubiquitous language.