3 ms·
Indeed - the acronym comes from The Pragmatic Programmer, and the author defined it in this way. Every blog post I've read criticizing/cautioning against DRY we
by BeetleB 2y ago
Indeed - the acronym comes from The Pragmatic Programmer, and the author defined it in this way. Every blog post I've read criticizing/cautioning against DRY were not doing DRY as originally defined.
DRY is almost always a good thing to do. Coupling superficially similar code is definitely not a good thing to do.
- haswell 2y agoYeah, here's the quote from the later editions addressing this: > Let’s get something out of the way up-front. In the first edition of this book we did a poor job of explaining just what we meant by Don’t Repeat Yourself. Many people took it to refer to code only: they thought that DRY means “don’t copy-and-paste lines of source.” That is part of DRY, but it’s a tiny and fairly trivial part. > DRY is about the duplication of knowledge, of intent. It’s about expressing the same thing in two different places, possibly in two totally different ways. > Here’s the acid test: when some single facet of the code has to change, do you find yourself making that change in multiple places, and in multiple different formats? Do you have to change code and documentation, or a database schema and a structure that holds it, or...? If so, your code isn’t DRY.
- dllthomas 2y ago> Coupling superficially similar code is definitely not a good thing to do. I've taken to calling that activity (removing syntactic redundancy that is only coincidental) "Huffman coding".