You Aren't Gonna Need It (YAGNI)
What you'll learn: How to avoid wasting time building features you don't actually need yet.
The Core Idea
YAGNI is a principle that warns against adding functionality based on what you think you'll need in the future. Instead, you should only implement features when they're actually required. This prevents speculative design—building things "just in case" that may never be used.
Why YAGNI Matters
When you add features preemptively, several problems arise:
- Wasted effort: Time spent building unused features could have been spent on real, immediate needs
- Added complexity: More code means more to test, debug, and maintain
- Wrong guesses: Your prediction about future needs is often incorrect, making the work useless
- Delayed value: Resources spent on speculative features delay delivering what users actually need now
An Analogy
Imagine packing for a weekend trip. YAGNI says: pack what you know you'll need. The opposite approach is throwing in a snorkel, winter boots, and formal wear "just in case"—your bag becomes heavy, cluttered, and harder to manage, yet you likely won't use those items.
YAGNI in Practice
When a teammate suggests, "Let's make this configurable so it can handle X in the future," ask: "Do we need X now?" If not, build the simpler solution that solves today's problem. You can always add complexity later when—and if—it's truly needed.
This pairs naturally with KISS (Keep It Simple, Stupid) and helps prevent violating DRY (Don't Repeat Yourself) through premature abstractions.
Key Takeaway: Build what you need today, not what you might need tomorrow—future requirements are unpredictable, and simpler code is easier to adapt when real needs emerge.