DRY (Don’t Repeat Yourself) can Go Wrong

Iman Tung
Aug 7, 2022

--

Don’t repeat doesn’t mean repeat for typing but repeat for thinking. If the two similar codes serve different purposes/concerns, then it is fine to get WET (Write Everything Twice).

When we DRY wrongly, we start to smell change preventers called Shotgun Surgery or Divergent Change.

Some tales tell that we need to wait to see three occurrences of similar codes before putting it as one function (Rule of Three).

--

--

Iman Tung

Technology to write, life to grateful. Overthinking is good, only if it has the output. Fundamental is the main concern.