Back to Glossary
Code Review & QualityPopular

Code Smell

A surface indication in the source code that usually corresponds to a deeper problem in the system. Not a bug itself, but a sign that refactoring may be needed.

Definition

The term "code smell" was coined by Kent Beck and popularized by Martin Fowler. Common code smells include: Long Methods (functions doing too much), God Classes (classes with too many responsibilities), Duplicate Code (copy-pasted logic), Feature Envy (methods that use another class's data more than their own), and Magic Numbers (unexplained numeric literals).

Why It Matters

Code smells indicate potential maintainability problems. While they don't prevent code from working, they make it harder to understand, modify, and extend. Studies show that code with multiple smells has 2-3x higher defect rates. Addressing smells early prevents technical debt accumulation.

Example

A method has 200 lines and 15 parameters — this is a "Long Method" code smell. It suggests the method should be broken into smaller, focused functions.

Related Terms

code smellwhat is code smellcode smells examplescode smell definition

Automate Code Review with diffray

Multi-agent AI system for code review. Automatically finds bugs, security vulnerabilities, and architecture issues.