wordfor

magic number

noun

Software design

  1. An unexplained literal value in code whose meaning is known only to whoever wrote it. Replacing if (retries > 7) with MAX_RETRIES turned a magic number into a decision someone can find and change.

In plain words

  • random numbers in the code
  • what does this 86400 mean
  • hardcoded values with no explanation
  • unexplained constant

See also code smell Chesterton's fence

Find similar words