code smell
/koʊd smɛl/
CommonA sign in the code that something is probably wrong, even if it works.
It's a heuristic, not a rule. Some code smells are acceptable tradeoffs. The term comes from the intuition that bad code 'smells' before it breaks.
Real-world examples4 examples
| # | Example | What it means | Source |
|---|---|---|---|
| 01 | the function takes a boolean flag to change its behavior. huge code smell. | Passing a boolean to change what a function does is a classic sign the function should be split. | x, 2023 |
| 02 | there are 47 commented-out lines and nobody knows why. code smell. | Dead code left in place is a sign the codebase lacks discipline and will accumulate confusion. | reddit, 2024 |
| 03 | whenever I see a class called 'Utils' I know it's a code smell. it means nobody thought about design. | Catch-all utility classes signal that code organization was avoided rather than done. | x, 2024 |
| 04 | left a comment in the PR: 'this works but it smells, we should revisit before v2' | Acknowledging a code smell without blocking the current PR, but flagging it for later. | x, 2023 |
Use it when
- Code review where something looks suspicious but isn't clearly broken.
- Flagging a design pattern that tends to cause problems over time.
- Teaching a junior dev to recognize warning signs in code.
Do not use it when
- You found an actual bug.Use “bug” instead.
- You just don't like the style choice.
- The code is slow.Use “performance issue” instead.
Origin and context
Popularized by Martin Fowler in his 1999 book 'Refactoring.' The metaphor of smell captures the intuition that something is wrong before you can formally prove it.
- First seen
- 1990s
- Confidence
- high
Cite this page
Use this stable URL to reference the entry.
https://slang.fyi/code-smellUpdated: 2026-08-28License: CC BY 4.0