YAGNI: You Aren’t Gonna Need It
YAGNI stands for “You Aren’t Gonna Need It” — a core principle of Agile software development that reminds developers to resist the urge to build functionality “just in case.” It encourages teams to implement only what is necessary today, rather than what might be useful in the future.
What Is YAGNI?
YAGNI is a discipline of simplicity. It tells you to write only the code you absolutely need right now — no extra features, no speculative architecture, no “future-proofing” unless you have a concrete use case driving it.
“Always implement things when you actually need them, never when you just foresee that you need them.”
— Ron Jeffries, Extreme Programming (XP) Co-founder
YAGNI is often associated with Extreme Programming (XP) but is widely used in Agile, Lean, and modern software practices.
Why It Matters
Building features you don’t yet need is tempting, especially for experienced developers who foresee future complexity. But doing so often leads to:
- Wasted effort on unused features
- Increased complexity in code and architecture
- More maintenance overhead
- Harder testing and debugging
- Delayed delivery of what’s actually needed
In short: code written without a current, concrete requirement is more likely to be a liability than an asset.
Real-World Examples
Violating YAGNI
“Let’s build a plugin system in case we want integrations later.”
At this point, there’s no integration requirement, no third-party interest, and no users asking for it. Yet days are spent designing an extensible plugin loader, config DSL, and hook system — which might never be used.
Following YAGNI
“Right now we only support Stripe. If another provider comes up, we’ll refactor then.”
This keeps the implementation simple, focused, and easier to change. If new payment options become necessary, refactoring with a known context is faster and safer than overengineering upfront.
YAGNI vs. Good Design
YAGNI doesn’t mean ignoring design or future flexibility. It means delaying complexity until it’s justified by real needs. A clean, modular design is still important — but speculative generalisation is not.
It aligns well with other principles like:
- KISS (Keep It Simple, Stupid)
- DTSTTCPW (Do The Simplest Thing That Could Possibly Work)
- Lean (Eliminate waste)
When to Apply YAGNI
YAGNI should be applied:
- During sprint planning when considering which features to build
- When writing new components or APIs
- When tempted to abstract something “just in case”
- In code reviews where unnecessary extensibility is introduced
Ask yourself:
“Do we need this now? Is there a real user story or requirement for this?”
If not — don’t build it.
YAGNI in Practice: How to Stay Disciplined
- Stick to the user stories at hand
- Time-box architecture discussions
- Use feature flags for experiments — not permanent scaffolding
- Document ideas for future improvements, but don’t build them
- Make refactoring a regular, accepted practice
Final Thoughts
YAGNI is a mindset that values focus, simplicity, and iterative development. It helps teams avoid wasted work and ship value faster. You’ll always have more ideas than time — YAGNI helps you invest wisely.
Build what’s needed, when it’s needed. No more, no less.