code smell
expressionprogramming
A surface sign in code that hints at a deeper design problem, without being a bug itself.
Long methods, duplicated logic, and giant classes are classic smells: the code runs, but something is off and likely to cause pain later. Kent Beck coined the term and Martin Fowler popularized it as a prompt to consider refactoring, not an automatic verdict.
A code smell is a surface indication that usually corresponds to a deeper problem, and the metaphor is doing careful work: a smell is not a bug, it is a hint that something may be wrong. Kent Beck coined the term and Martin Fowler popularized it in the refactoring literature, deliberately choosing a word that implies suspicion rather than proof.
The classic catalogue is worth knowing because it gives names to things everyone recognizes. Long methods, large classes, long parameter lists, duplicated code, feature envy where a method is more interested in another class than its own, and shotgun surgery where one change requires edits in a dozen places. Naming them turns a vague unease during review into a specific observation someone can act on.
The failure is treating the catalogue as a rulebook. A long method that reads clearly and does one thing is fine, and mechanically breaking it into six small ones can make the logic harder to follow. Smells are prompts for investigation, not violations, and a codebase optimized to eliminate every smell is optimizing for a metric rather than for the humans who have to read it.
Also known as: smell, bad smell in code
Sources
- Fowler, 'Refactoring' (1999), attributing Kent Beck