Programming foundations

Stage 5 · Lesson 5 of 10

DRY, KISS and YAGNI

Object-oriented design and clean code

These are three short principles that work best as questions while refactoring (tidying code without changing what it does). means do not repeat yourself. If the same rule is written in three places, one day only two get updated, so give it one home.

KISS means keep it simple: prefer the plainest solution that works over a clever one. YAGNI means you are not going to need it. Do not build options, settings or abstractions for a future that may never come.

The three pull against each other. Removing every trace of duplication often adds a confusing abstraction, so a common rule of thumb is to wait for the third copy. Apply them to working code, not to a blank page.

A question to check yourself, an AI practice session and 1 cheat sheet entry come when you add the roadmap to your account. Add it

Resources for this stage

Start with· follow one of these

Practise

  • Request mentoring on a solved exercise and ask specifically about naming and structure

Keep handy

  • Fast test runner for Node.js projects; the getting started page is all you need now

Also worth your time

Mark this stage as not done?