Knowledge
Search knowledge... ⌘K
Knowledge · Anti-Patterns
Smell Feature Envy
Anti-pattern indicating need for refactoring
Tags
refactoring-fowlercode-smellmaintainability
Impact
A method that seems more interested in a class other than the one it actually is in. The most common focus of the envy is the data - a method that invokes half-a-dozen getting methods on another object to calculate some value.
Symptoms
- Method uses more features of another class than its own
- Method invokes many getters on another object
- Method calculates values from another object's data
Source
Martin Fowler — Refactoring: Improving the Design of Existing Code, 1st Edition (1999)