Skip to content

Instantly share code, notes, and snippets.

@aniket-fueled
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aniket-fueled/91aa2bef37460729bf94 to your computer and use it in GitHub Desktop.
Save aniket-fueled/91aa2bef37460729bf94 to your computer and use it in GitHub Desktop.
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??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment