Feature Envy
Updated 2026-07-30
Summary
A type of code smell
Definition
A type of code smell. It refers to a module (or a person) that excessively focuses on and frequently accesses another module's data, as if it would rather live in that module. This usually indicates unclear division of responsibilities. Scaffold use: boundary review. If you find yourself always making decisions that should be made by others (or other departments), or always cleaning up after others, you have 'Feature Envy'. Return responsibilities to the correct owner.
Introduction
How to use
Boundary review. If you find yourself always making decisions that should be made by others (or other departments), or always cleaning up after others, you have 'Feature Envy'. Return responsibilities to the correct owner.
Mechanism
Feature Envy is a code smell: when module A frequently reads module B's data and performs calculations on it, it indicates that the 'data' and the 'logic that operates on the data' should belong together, and the division of responsibilities is misplaced. The same applies at the organizational level—if one entity always makes decisions for another, it means the boundaries of authority and responsibility are misaligned.
Practice
In progress 0/4Practice this model in one real situation:
Cases
- Class A heavily reads fields of class B and performs calculations (should move the method to B); departments covering for each other, blurred boundaries leading to buck-passing and duplicated work.
Common pitfalls
- Misinterpreting frequent cross-boundary access as 'collaboration'; continuously adding methods to the wrong owner; ignoring boundaries and single responsibility.
Sources
Source support: Explicit
- kpcq.org.cnhttps://www.kpcq.org.cn/kitchen/458/419012958.shtmlverified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS