DEV Community

Cover image for YAGNI: Why You Shouldn’t Build What You Don’t Need
Athreya aka Maneshwar
Athreya aka Maneshwar

Posted on

YAGNI: Why You Shouldn’t Build What You Don’t Need

Hello, I'm Maneshwar. I’m building LiveReview, a private AI code review tool that runs on your LLM key (OpenAI, Gemini, etc.) with highly competitive pricing -- built for small teams. Do check it out and give it a try!

In software development, it’s easy to fall into the trap of overengineering, building for every possible scenario, adding features “just in case,” or preparing for a future that may never arrive.

That’s where YAGNI comes in.

What Is YAGNI?

YAGNI stands for “You Aren’t Gonna Need It.”

It’s a principle from extreme programming that advises developers not to add functionality unless it’s immediately required.

At its core, YAGNI is about keeping things simple.

Instead of trying to anticipate every possible feature request, you only build what’s needed today.

This keeps codebases:

  • Lean and maintainable
  • Easier to test and debug
  • Less prone to technical debt

YAGNI is closely related to the Single Responsibility Principle (SRP) and the Open/Closed Principle (OCP) from SOLID design.

All of them encourage developers to build software that is simple, focused, and adaptable.

Why YAGNI Matters

Building unnecessary features feels productive, but it often backfires.

  1. Wasted Effort – Developers may spend weeks creating a feature that customers never use.
  2. Missed Deadlines – Time spent on “future-proofing” can delay current deliverables.
  3. Complexity Creep – Extra abstractions make the codebase harder to understand.
  4. Rework Risk – Future assumptions often change, forcing developers to redo what they “prepared ahead.”

As agile methodology stresses, software development works best with tight feedback loops and incremental delivery.

YAGNI ensures teams stay focused on solving actual, current problems rather than imagined ones.

A Simple Example

Imagine a team updating a database. Someone notices that a roadmap feature will require a new field in the future and says:
“While we’re here, let’s just add it now.”

That’s a YAGNI red flag.

When the feature request finally arrives, requirements may have shifted.

Developers now need to rip out or modify that extra field — wasting both the earlier effort and the new one.

The safer, YAGNI-aligned approach is to add the field only when the feature truly arrives.

How to Implement YAGNI

Applying YAGNI sounds simple, but it can be tough in practice. Here are some strategies:

1. Prioritize Ruthlessly

Break work into small increments and focus only on what delivers value right now.

If something isn’t essential, defer it.

2. Use Minimum Viable Products (MVPs)

When stakeholders request features, start with a lightweight experiment.

Test with a working prototype before committing to a full build.

3. Say “No” (or “Not Yet”)

Engineers love solving problems — but not every request should be tackled immediately.

Learning to politely defer requests is a key YAGNI skill.

4. Focus on Value, Not Features

Always ask: Does this directly deliver business value today? If the answer is no, it’s probably YAGNI.

YAGNI Beyond Code

Although born in software, YAGNI applies to business as well:

  • Meetings – Don’t schedule recurring ones you don’t need.
  • Documentation – Don’t maintain docs nobody uses.
  • Contracts – Long, rigid agreements may not be necessary; short, value-based ones can work better.

Agile consultant Vasco Duarte even extends YAGNI to #NoEstimates, encouraging teams to stop wasting time on estimates they don’t need and focus instead on delivering small, testable value increments.

Key Takeaway

YAGNI is about discipline.

It’s a reminder that complexity is easy to add, but hard to remove.

By resisting the urge to build for a future that might never come, developers save time, reduce waste, and keep their codebases clean.

The next time you hear someone say:
“While we’re here, let’s just add it…”
That’s your YAGNI alarm bell.

Build what you need, when you need it.

Nothing more.

LiveReview helps you get great feedback on your PR/MR in a few minutes.

Saves hours on every PR by giving fast, automated first-pass reviews.

If you're tired of waiting for your peer to review your code or are not confident that they'll provide valid feedback, here's LiveReview for you.

Top comments (6)

Collapse
 
anik_sikder_313 profile image
Anik Sikder

YAGNI isn’t just a coding principle, it’s a mindset shift. The temptation to “pre-solve” future problems is strong, especially in early-stage teams trying to anticipate scale. But disciplined deferral is often the most strategic move.
Loved how you tied it to SRP and OCP. I’d add that YAGNI also complements lean architecture keeping interfaces minimal until pressure demands expansion.
Also, LiveReview sounds promising. Curious how it handles nuanced feedback across different LLMs. Will give it a spin.

Collapse
 
nyaomaru profile image
nyaomaru

Thank you for the nice article!
I love the idea of YAGNI and the phrase "complexity is easy to add, but hard to remove."

It also feels like this mindset applies not only when creating utils, but also in life itself, sometimes the best choice is simply not to use what’s unnecessary.

Collapse
 
leob profile image
leob

Big fan of the YAGNI principle, total no-brainer ...

Collapse
 
lovestaco profile image
Athreya aka Maneshwar

True

Collapse
 
prime_1 profile image
Roshan Sharma

Love this! The reminder to only build what you actually need
No more, no less is just solid dev wisdom.

Collapse
 
xwero profile image
david duymelinck

I you go too extreme you will hurt yourself, like with every concept.
Programming is finding the right gray tone between black and white.

The customer wants a website that has three pages types with a predefined layout.
If you take YAGNI to the extreme you can hardcode the pages.
if you ask the customer if this could change in the future. They might say yes. Then you can use a CMS solution.
Both the hard coding and adding a CMS can take the same time.
But for the hard coded application it could mean adding fundamental features can take as long as the initial development time. While for the framework solution adding features could be just changing some config.

Only looking at what is needed now is shortsighted when it comes to a long term project.
There are levels of probability a feature is going to get added or not. And the higher the level the more you have to take it into account for the current development.
There is also the impact of a feature on the codebase. The higher the impact on the code, the more the set up code should be considered to be added early.

I think the field example in the post is a bad example. Because if it is on the roadmap but it is not for now, why add it before it is scheduled?
That has nothing to do with YAGNI, that is just not following the planning.

YAGNI is just an acronym that makes you reflect on the value of the code. Don't make it a bigger thing than it is.