The Smell Families
The Smell Families: Smells of Choosing: The switch That Keeps Growing, Smells of Making: new Everywhere, Smells of Tangling: Reaching Through Objects, Smells…
Updated
- Smells of Choosing: The switch That Keeps Growing (Journeyman): When the same switch on a kind of thing is copied into many places, a new kind means a hunt through the code and one copy is always missed; the smells of choosing all come from one decision with no home, and their cures give it one.
- Smells of Making: new Everywhere (Journeyman): When the code that uses an object also builds it (new scattered through business code, a constructor with nine arguments, a class that opens its own database connection), every change to how things are made touches the code that uses them, and nothing can be tested on its own; the cures give making its own home.
- Smells of Tangling: Reaching Through Objects (Journeyman): When code reaches through one object to another to get an answer (booking.member().plan().price()), one small rule change touches every place that reaches, and one is always missed; the smells of tangling all come from code that knows too much about other objects, and their cures move the knowledge to where it belongs.
- Smells of Size: The Long Method and the Class That Does Everything (Journeyman): When one method or class keeps every job that was ever added to it, nothing inside can be reused or tested on its own, and a new feature means copying part of it; the smells of size come from jobs that were never given names, and the plainest cure, pulling out a method, gives them one.
- Smells of Combining: A Class for Every Combination (Journeyman): When every mix of features gets its own class (YogaClassWithReminderAndWaitlist), or every missing piece gets its own null check, each new feature doubles the classes or adds a check to every screen; the smells of combining come from building mixes by copying instead of from small parts, and their cures put the parts together.