← System Design
✂️
System Design

DRY · KISS · YAGNI

The three guardrails that stop over-engineering before it starts — Don't Repeat Yourself, Keep It Simple, You Aren't Gonna Need It.

TL;DR

DRY (Don't Repeat Yourself) — every piece of knowledge should have one authoritative source. KISS (Keep It Simple, Stupid) — the simplest design that works is usually right. YAGNI (You Aren't Gonna Need It) — don't build for hypothetical futures. They tug against each other on purpose; the discipline is knowing which one to apply when.

When to use

On every code review and every design doc. These three are the cheapest senior-engineer filter you can run against a proposal — if the design fails any of them, you usually haven't found the right design yet.

Try it

DRY — the rule, and the trap

Don’t Repeat Yourself. Every fact about your system should have one source of truth. Duplicated logic = duplicated bugs.

KISS — the rule, and the trap

Keep It Simple. The simplest design that solves the problem is almost always the right one. Complexity has a maintenance bill that compounds.

YAGNI — the rule, and the trap

You Aren’t Gonna Need It. Don’t build features, abstractions, or flexibility for use cases you don’t have yet.

How they interact

                  DRY → reduce duplication

                   |
  YAGNI ← (tension) → KISS
                   |

            Don't add what you don't need (yet)

In system design interviews

These three explain why most candidate designs lose points:

  • Over-engineering (YAGNI failure) — adding caching, queues, sharding before justifying the load.
  • Under-engineering (KISS failure) — three undocumented hacks that work for the demo but won’t survive on-call.
  • Premature abstraction (DRY failure) — a generic event-bus framework when one POST endpoint would do.
📺 Video

A YouTube walkthrough — coming once the deep-dive video is published.

🧪 Simulator

An interactive simulator for this concept is on the way — tweak the knobs, watch behaviour change in real time.

💻 Code

A 30-line build challenge with starter code, hints, and a reference implementation.

🎯 Common interview questions
Q1. Aren't DRY and YAGNI the same thing?

No — they often conflict. DRY says "extract the common logic." YAGNI says "don't extract until you actually have duplication that hurts." Premature DRY is the worse failure mode in practice — you couple two things that *look* similar but evolve in different directions, and now every change requires touching both.

Q2. When should you violate DRY on purpose?

When two pieces of code look the same today but represent different *concepts* — e.g., a validation rule that happens to share a regex with an unrelated formatting rule. Couple them and the day they diverge you have to untangle a shared abstraction, which is more painful than the original duplication.

Q3. How do you sell KISS in a code review?

Ask "what's the simplest thing that could work for the next 6 months?" If the proposal is more complex, the author should explain *which specific future requirement* justifies the extra complexity — and if they can't, that's the YAGNI flag.

Q4. How does YAGNI apply to system design?

Don't introduce Kafka because you "might" need an event log. Don't shard the database because you "might" hit scale. Build the simplest architecture for current load + 10×, instrument it so you can see when it actually starts hurting, and only then evolve. Premature scaling is the #1 source of complexity that never paid off.

↗ Related concepts

Comments 0

Discuss this page. Markdown supported. Be kind.

Loading…
Loading comments…