It’s not a rule that must be followed, just a principle.
Good summary article Are you misinterpreting the DRY principle?
-
All knowledge must have a single, clear, and reliable representation in the system.
-
Most people take DRY to mean you shouldn’t duplicate code. That’s not its intention. The idea behind DRY is far grander than that. DRY says that every piece of system knowledge should have one authoritative, unambiguous representation. Every piece of knowledge in the development of something should have a single representation. A system’s knowledge is far broader than just its code. It refers to database schemas, test plans, the build system, even documentation.
Related Write everything twice.
This page is auto-translated from /nishio/DRY原則 using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I’m very happy to spread my thought to non-Japanese readers.