magic numbers

Unexplained hardcoded values

Magic numbers are specific values that appear in code or formulas without explanation, making their purpose unclear to anyone reading them.

Programmers consider them bad practice because they obscure meaning: Replace that magic number with a named constant.

The term extends to any seemingly arbitrary figures whose significance isn't obvious: The budget relies on magic numbers that nobody can justify.

Opposites
code clarity and maintainability

magic numbersclean code

Well-organized, maintainable programming

numerological significance

magic numbersrandom numbers

Unordered, patternless integers

Family

magic, magical, magician, numbers, magically, magicians, magic number, nonmagical, unmagical

Familiarity
Top 500,000
Profile
Used worldwide · Timeless · Positive · Rated G