Skip to content
Ameen Abozaid
In reviewJNR-003-L04

DRY, KISS, YAGNI — and their limits

  • Lesson 4 of 7
  • 11 min read
  • Junior
On This Lesson 4 topics

The content for this lesson is written and waiting for review. The outline below shows what it covers. It will be published once it is approved.

In this lesson

apply three rules and know when they clash.

Planned topics

  • DRY: do not repeat the same knowledge in many places.
  • KISS: keep it simple; the simplest design that works.
  • YAGNI: do not build things you do not need yet.
  • Conflict: removing small duplication can make code more complex (DRY against KISS).
  • Rule of thumb: wait for the third repeat before you abstract; similar code is not always the same knowledge.
Draft outline details

Demonstration

two similar methods; one merge that needs a flag parameter and gets harder to read.

Check your understanding

When do you abstract repeated code?

Show answer

When the same idea appears about three times and is really the same.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.