Overview
Code smells are not bugs—they don't stop the program from working. Instead, they are indicators of poor design or implementation choices that make the code harder to maintain or more prone to bugs in the future.
Common Smells
- Long Method: A function that does too many things.
- Large Class: A class that has too many responsibilities.
- Duplicated Code: Violating the DRY principle.
- Primitive Obsession: Using primitive types instead of small objects for domain concepts.
- Shotgun Surgery: A change that requires making many small changes to many different classes.
Solution
Code smells are usually resolved through Refactoring.