HOW_TO_NAME_THINGS!

“There are only two hard things in Computer Science 0. Off-by-one errors 1. cache invalidation 2. naming things” – Phil Karlton

Things to remember

  • Let the meaning choose the word.
  • Describe the thing you have been visualising you probably hunt about until you find the exact words that seem to fit it.
  • Never use metaphor, toolongaword, jargon
  • Break_the_word_if_its_too_long
  • Abbreviations are ambiguous for instance char stands for character or characteristics. But try to make it more meaningful.
  • Allow one exception: id for ‘identity’
  • One letter is too short for instance, var a, var b
  • Vague words are vague for instance “manager” could mean supervisor, planning manager etc.
  • Don’t get confused with synonyms :
    • order IS NOT EQUAL TO shipment
    • carrier IS NOT EQUAL TO broker INSTEAD
    • shipment IS EQUALS TO consignment
    • carrier IS EQUALS TO transporter
  • Multiple words can be replaced by more specific words e.g company_person means employee or owner!! Don’t be too generic!

Examples

  • What is the worst ever variable name?
  • data
  • What is the second-worst name?
  • data2

Any guesses for the third one??

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>