Refactoring Workbook
Symptoms
Causes
This can happen when one part of an object has an algorithm that passes around information through the fields rather than through parameters; the fields are valid or used only when the algorithm is active. That the fields are sometimes used and sometimes not suggests that there may be a missing object whose life cycle differs from that of the object holding it. What to Do
Payoff
Improves communication and clarity. May reduce duplication, especially if other places can make use of the new class. Contraindications
It may not be worth the trouble of creating a new object if it doesn't represent a useful abstraction. |