11 ms·
> DRY is about not repeating requirements in code. Exactly! A lot of developers, even experienced (and I would include the OP, even after his supposed lesson)
by brabel 7y ago
> DRY is about not repeating requirements in code.
Exactly! A lot of developers, even experienced (and I would include the OP, even after his supposed lesson) seem to not get this: duplication is only bad when what is being duplicated MUST behave the same by definition (i.e. if you change one but not the other, the other would've become broken as its definition would still be the same as the changed one). Otherwise, two similar or identical codes are NOT duplicated in a way that violates DRY, they are just coincidental - as they might become different later - so the "duplication" in this case must NOT be removed (but perhaps a smaller portion of the code might be duplication of definition, which should be then extracted and de-duplicated). It really isn't that hard.
- bagacrap 7y agoProblem is, it's hard to tell the difference in advance. In this case, it only became apparent to OP some time down the line.