How past code investment influences present programming decisions
Core Idea: Programmers often feel compelled to preserve and extend existing code regardless of its quality due to the psychological influence of previously invested effort.
Key Elements
- The sunk cost fallacy is a cognitive bias where past investments irrationally influence current decisions
- In programming, complex or confusing code often exerts a stronger pull to be preserved
- Developers mistakenly equate complexity with importance or correctness
- This leads to reluctance to replace or rewrite problematic code
- The fallacy manifests as attempts to adapt poor abstractions rather than starting fresh
Psychological Aspects
- Developers unconsciously think: "This complex code must have taken ages to get right"
- Fear of wasting previous effort leads to preservation of problematic approaches
- More effort invested makes abandonment psychologically harder
- Code presence itself suggests correctness and necessity
- Organizational cultures may reinforce sunk cost thinking by discouraging rewrites
Overcoming Sunk Cost Thinking
- Recognize when you're preserving code primarily because of past investment
- Evaluate code based on current utility rather than past effort
- Reframe rewrites as "advancing in a better direction" rather than "retreat"
- Focus on future maintenance costs rather than past development costs
- Give yourself permission to abandon approaches that no longer serve your needs
Connections
- Related Concepts: The Wrong Abstraction (common scenario where sunk costs appear), Technical Debt (how sunk cost perpetuates problems)
- Broader Context: Cognitive Biases in Programming (broader pattern of how psychology affects development)
- Applications: Refactoring Decision Making (practical application in maintenance choices)
References
- Metz, Sandi. "The Wrong Abstraction." Blog post. Originally from Chainline Newsletter.
- "Loss Aversion and the Sunk Cost Fallacy," Wikipedia.
#psychology #programming #decision_making #cognitive_bias
Connections:
Sources: