2 ms·
Hey, you mean "DRY IA TO"! Don't repeat common phrases like "is a" and "trade-off", damn it! Define an acronym and use that instead. DRY is literally impossibl
by kazinator 6y ago
Hey, you mean "DRY IA TO"! Don't repeat common phrases like "is a" and "trade-off", damn it! Define an acronym and use that instead.
DRY is literally impossible. If something has to be performed or evaluated two or more times, and you factor that out under a definition, you still have to invoke the definition multiple times. I.e. you are still repeating yourself, just using an abbreviation.
What you are doing is called "compression". Classic data compression algorithms like LZ77 work by abbreviating.
"LZ77 algorithms achieve compression by replacing repeated occurrences of data with references to a single copy of that data existing earlier in the uncompressed data stream. " - Wikipedia
Outside of alcoholic drinks, that's the ultimate DRY.
Thus, the argument against DRY is obvious: it's a form of compression, and excessive compression destroys readability: or else we would all be able to read source code that has been put through LZ77.
Only mild compression improves readability. Mild compression improves readability largely because it's easier to see that two brief invocations of a definition are exactly the same, than to see that two repetitions of a code block are exactly the same. When we see that two code blocks are exactly the same, we don't have to understand them separately.
Basically, brainless repetition and verbosity hinders readability, as does dense, thorough compression. One extreme might be represented by reams of Java boilerplate; the other by IOCCC entries.