YAGNI Principle
Overview
YAGNI means You Aren't Gonna Need It. Do not implement functionality until there is a real, current requirement.
Why YAGNI Helps
Unused code creates maintenance burden and design noise.
flowchart TD
A[Speculative Features] --> B[More Code Paths]
B --> C[Higher Test Surface]
C --> D[More Defects and Delay]
Practical Example
A team adds plugin architecture before validating product-market fit. The result is longer delivery cycles and harder debugging.
A lean first iteration:
public static Invoice ProcessInvoice(Invoice invoice)
{
// Implement current business rule only
return ApplyVat(invoice);
}
Production Guidance
- Build for current validated requirements
- Keep extension points where change is likely, not everywhere
- Revisit architecture after usage data and incident patterns
Common Pitfalls
- Building generalized frameworks too early
- Treating every roadmap idea as immediate implementation work
- Confusing flexibility with premature abstraction
Key Takeaways
- YAGNI protects delivery speed and code clarity.
- Defer complexity until it is justified by evidence.
- Small, focused implementations improve adaptability.