Dead Code
Symptoms
A variable, parameter, field, code fragment, method, or class is not used anywhere (perhaps other than in tests).
Causes
Requirements have changed, or new approaches are introduced, without adequate cleanup. Complicated logic results in some combinations of conditions that can't actually happen; you'll see this when simplifying conditionals.
What to Do
Payoff
Reduces size. Improves communication. Improves simplicity.
Contraindications
If your application is a framework, you may have elements present to support clients' needs that, strictly speaking, aren't needed by the framework itself. For example, a class may have an empty hook method intended to be called by (not-yet-existing) subclasses.
Notes
This smell can be hard to detect without tool support. Once your suspicions are alerted, you can do things like a global search for new ClassName.
 |