Technical debt is the cost of future rework from choosing quick solutions over better approaches.
Types of Debt#
Intentional Debt#
// TODO: Replace with proper caching before launch
const cache = new Map(); // Simple in-memory cache for MVPUnintentional Debt#
// Class that grew to 50 methods over time
class UserService {
// 2000 lines, needs splitting
}Identifying Debt#
Code Smells#
- Long methods (>30 lines)
- Deep nesting
- Duplicate code
- Magic numbers
- God classes
Prioritization#
High Impact + Low Effort = Fix Now
High Impact + High Effort = Schedule
Low Impact + Low Effort = Fix Soon
Low Impact + High Effort = Consider Later
Paying Down Debt#
Boy Scout Rule#
// Leave code better than you found it
// While fixing a bug, also add types
function processUser(user: User): ProcessedUser { }Sprint Allocation#
- 70% Features
- 20% Technical debt
- 10% Bug fixes
Preventing New Debt#
- Definition of Done includes quality checks
- Code review standards
- Automated linting and testing
Track debt systematically, prioritize by impact, and allocate time consistently to address it.