Paul Stephen Borile
Sep 5, 2018 · 1 min read

imho DRY principle is only incidentally about code duplication. The real concept around DRY is knowledge duplication which in turn makes maintenance a nightmare (if you change algorithm or data behind that knowledge you should not need to change it 10 different places in the code).
An interesting definition of DRY is from the “The Pragmatic Programmer” :

Every piece of knowledge must have a single, unambiguous, authoritative representation with a system

DRY, as all principles, needs to be interpreted : if the code you are repeating will need to be maintained frequently i.e. if a requirement change will affect duplicated code, then probably that’s a piece of knowledge in your code and having it in one place is always a good choice.
-Paul

Paul Stephen Borile

Written by

Director of Software Engineering at Scientiamobile Inc, bass player and mountain bike addicted, https://www.paulstephenborile.com