Highlighted Code Smells
In our experience, we have found that the most dangerous code smells are: Duplication, Primitive Obsession, Feature Envy, and Message Chains. For that reason, we decided to highlight them, especially the last three, as we have already paid enough attention to duplication in previous lessons.
Code Smells Hierarchy
Primitive obsession, feature envy, and message chains lead to many other code smells and should thus be dealt with as soon as possible.
Primitive obsession
- Duplicated code
- Shotgun surgery
- Divergent change
- Long parameter list
Feature Envy / Inappropriate Intimacy
- Lazy class
- Data class
- Middleman
- Data clumps
- Long method
- Large class
- Duplicated code
- Shotgun surgery
- Divergent change
- Long parameter list
Message Chains
- Data clumps
- Duplicated code
Primitive Obsession
Don't use primitive types as substitutes for classes. If a data type is sufficiently...