Skip to content

Latest commit

 

History

History
14 lines (9 loc) · 575 Bytes

rule-of-three.adoc

File metadata and controls

14 lines (9 loc) · 575 Bytes

Rule of three

Code refactoring rule of thumb: "two instances of similar code don’t require refactoring, but when similar code is used three times, it should be extracted into a new procedure."

The premise is that having additional example patterns is often useful for abstracting a design or coming up with a generic solution. KISS > DRY otherwise.

Duplication is far cheaper than the wrong abstraction.
— Sandi Metz