Intermediate Topic 19 of 50 Software Engineering
DRY, KISS and YAGNI
Heuristics against duplication, complexity and speculation.
How it works
DRY, do not repeat yourself, says every piece of knowledge should have a single authoritative representation in the system, so a change needs to be made in one place. KISS, keep it simple, favors the simplest solution that works. YAGNI, you aren't gonna need it, warns against building features or generality for hypothetical future needs. Together they steer designs away from duplication, over-engineering and speculation.
Step-by-step walkthrough
- DRY: do not repeat yourself, keep each piece of knowledge in one place.
- KISS: keep it simple, the simplest solution that works.
- YAGNI: you are not going to need it, do not build features speculatively.
- They fight duplication, complexity and waste.
- Use judgment, too much DRY can couple unrelated code.
Where it is used
Developers apply them when deciding to extract a function, whether to add a configuration option or when to introduce an abstraction, and in code reviews.
Common pitfall
DRY applied too eagerly merges code that merely looks alike but changes for different reasons, creating tangled abstractions; some duplication is cheaper than the wrong abstraction. Simplicity does not mean sloppy. YAGNI does not forbid planning for known requirements. Wait until duplication appears a few times before abstracting.
Where it fits in the course
DRY, KISS and YAGNI is topic 19 of 50 in Software Engineering, rated Intermediate. It follows SOLID Principles. The next topic is Design Patterns.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Software Engineering quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Software Engineering quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is DRY, KISS and YAGNI?
Where do people use DRY, KISS and YAGNI?
What is the most common mistake with DRY, KISS and YAGNI?
What should I learn before this topic?
How can I practice it?
Is DRY, KISS and YAGNI hard to learn?
How long does it take to learn DRY, KISS and YAGNI?
Which topics are related to DRY, KISS and YAGNI?
What should I study after DRY, KISS and YAGNI?
Related topics
- SOLID Principles (Software Engineering)
- Design Patterns (Software Engineering)
- Software Maintenance (Software Engineering)
- Singleton Pattern (Software Engineering)