2 ms·
The page you linked to directly refutes your claim of narrowness: Most people take DRY to mean you shouldn't duplicate code. That's not its intention.
by lobster_johnson 10y ago
The page you linked to directly refutes your claim of narrowness:
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
Note the terms knowledge and representation. He's referring to things like declarations, data models, schemas, facts. Duplicate source code symbols has nothing to do with it.
DRY is not "be terse". For example, turning a literal into a constant is DRY, because it reduces to a single "authorative, unambiguous representation". But "x = x + 1" (which certainly looks redundant) is not anti-DRY, nor is "end Foo;".