The following table relates code smells to relative essence. Column 'Fowler' refers to the page in Fowler's "Refactoring" book describing this smell. Column 'Wake' refers to the category of smell in Wake's "Refactoring Workbook". Column 'Kind' distinguishes between "Within Class" and "Between Class" smells. Column 'Smell' provides the name of the smell according to Fowler/Wake and may include commonly used aliases. Column 'Essence' describes the correlation of the smell with relative essence: "+" (higher relative essence correlates with more smell), "0" (no direct relationship between relative essence and smell), and "-" (lower relative essence correlates with more smell).
Fowler | Wake | Kind | Smell | Essence | Comment | ||
---|---|---|---|---|---|---|---|
page 87b | Measured Smells | Within | Comments / Deodorant | 0 | + | refactoring may involve extract method | |
page 76b | Measured Smells | Within | Long Method | + | refactoring involves extract method | ||
page 78b | Measured Smells | Within | Long Parameter List | 0 | smell is more about coupling than indirection | ||
page 76a | Duplication | Within | Duplicated Code | 0 | (+) | might be positive because duplication is more probable for high complexity/essence code | |
page 78a | Measured Smells | Within | Large Class | 0 | except if also "Long Method" | ||
Names | Within | Type Embedded in Name | 0 | ||||
Names | Within | Uncommunicative Name | 0 | ||||
Names | Within | Inconsistent Names | 0 | ||||
Unnecessary Complexity | Within | Dead Code | 0 | ||||
page 83c | Unnecessary Complexity | Within | Speculative Generality | (-) | 0 | negative if "generality" involves extra indirections/extra abstraction layers | |
page 81b | Data | Between | Primitive Obsession | + | introducing classes would introduce non-"essential" methods for encapsulation | ||
page 86b | Data | Between | Data Class | (-) | 0 | might be negative, but it could also be about coupling (methods exist in some other class) | |
page 81a | Data | Between | Data Clumps | 0 | + | grouping data into a class might just move fields, or might introduce a new class with encapsulation | |
page 87a | Inheritance | Between | Refused Bequest | 0 | + | otherwise new super class might be introduced, so there could be a new constructor | |
page 85b | Inheritance/Responsibility | Between | Inappropriate Intimacy | 0 | + | extra new class could have appeared | |
page 83b | Inheritance | Between | Lazy Class / Freeloader | - | refactoring may involve inline class; class has to be eliminated, thus all its methods; because it was lazy, it probably had no loops | ||
page 80b | Responsibility | Between | Feature Envy | 0 | + | otherwise method would be moved or extracted | |
page 84b | Responsibility | Between | Message Chains | 0 | + | refactoring may involve extract method | |
page 85a | Responsibility | Between | Middle Man | - | refactoring may involve inline method | ||
page 79a | Accommodating Change | Between | Divergent Change | + | refactoring involves extract class | ||
page 80a | Accommodating Change | Between | Shotgun Surgery | - | 0 | refactoring may involve inline class | |
page 83a | Accommodating Change | Between | Parallel Inheritance Hierarchies | 0 | |||
page 82 | Conditional Logic | Within | Switch Statements / Simulated Inheritance | + | refactoring involves extract method and new classes | ||
page 84a | Data | Between | Temporary Field | + | refactoring involves extract class | ||
page 85c | Duplication | Within | Alternative Classes with Different Interfaces | 0 | + | refactoring may involve extract super class | |
page 86a | Library Classes | Between | Incomplete Library Class | 0 | + | refactoring may introduce foreign method | |
Duplication | Within | Magic Number | 0 | ||||
Conditional Logic | Within | Null Check | 0 | ||||
Conditional Logic | Within | Complicated Boolean Expression | 0 | ||||
Conditional Logic | Within | Special Case | 0 | + | may lead to special case being handled separately | ||
Accommodating Change | Between | Combinatorial Explosion | 0 | (+) | might be positive, because duplication is more probable for complex/essential code |
Of the 31 smells, 3 strongly indicate low relative essence, 2 weakly indicate low relative essence, 2 weakly indicate high relative essence, and 14 strongly indicate high relative essence. This means that most of the commonly known smells represent issues where the relative essence is too big. This may be an indication that in practice, most problems with software are related to the lack of modularization. Nevertheless, there are some smells (especially "Lazy Class/Freeloader", "Middle Man", and "Shotgun Surgery") that indicate that the relative essence is too low and the amount of indirection too high.