Knowledge
Search knowledge... ⌘K
Knowledge · Anti-Patterns
Smell Temporary Field
Anti-pattern indicating need for refactoring
Tags
refactoring-fowlercode-smellmaintainability
Impact
An instance variable that is set only in certain circumstances. Such code is difficult to understand because you expect an object to need all of its variables.
Symptoms
- Instance variable used only in certain circumstances
- Variables valid only during specific operations
- Algorithm stores state in fields instead of parameters
Source
Martin Fowler — Refactoring: Improving the Design of Existing Code, 1st Edition (1999)