🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

Programming Concepts Beginner

What is Code Smell?

A surface indication in code that usually corresponds to a deeper problem in the system, suggesting the need for refactoring.

Code smells are not bugs — the code works correctly — but they indicate design weaknesses that may cause problems over time. Common smells include: Long Method (functions doing too much), God Class (a class that knows too much), Feature Envy (a method that uses another class's data more than its own), Primitive Obsession (using primitives instead of small objects), Shotgun Surgery (a change requires modifying many classes), and Duplicate Code. Martin Fowler's refactoring catalog provides specific techniques for addressing each smell. Static analysis tools (SonarQube, PHPStan) can detect certain code smells automatically.

Related Terms

Event-Driven Architecture
A software design pattern where components communicate by producing and consuming events rather than direct method calls.
Technical Debt
The implied cost of additional rework caused by choosing a quick solution now instead of a better approach that would take longer.
Design Pattern
A reusable solution template for commonly occurring problems in software design.
Twelve-Factor App
A methodology of twelve best practices for building modern, scalable, maintainable software-as-a-service applications.
Algorithm
A step-by-step procedure for solving a problem or performing a computation, defined as a finite sequence of instructions.
Factory Pattern
A creational design pattern that provides an interface for creating objects without specifying their exact classes.
View All Programming Concepts Terms →