3 ms·
The whole DRY concept irritates my inner curmudgeon because it is itself a lousy repetition of the (formal mathematical) concept of refactoring. When you refac
by carapace 6y ago
The whole DRY concept irritates my inner curmudgeon because it is itself a lousy repetition of the (formal mathematical) concept of refactoring. When you refactor code it's just like factoring an algebraic equation. If you're just removing duplication without understanding how it affects the structure of the system then it's a kind of "cargo cult" programming (IMO.)
Even when you know what you're doing. there's good refactoring[1] and bad refactoring[2].
[1] https://osdn.net/projects/joypy/scm/git/Thun/commits/aa43eb668492e03a5d2c6cc5010479f6e0cba220 https://osdn.net/projects/joypy/scm/git/Thun/commits/aa43eb6... This is a good clean bit of refactoring: it makes the branch symmetrical and lets you move code to a common post-branch step.
[2] https://github.com/calroc/HulloWurld/blob/master/Hullo.html#L476-L488 https://github.com/calroc/HulloWurld/blob/master/Hullo.html#... This is a terrible function that, while it abstracts the core of the two following functions well, makes the system harder to understand. In other words, the three factored functions are less desirable than the original pair of functions despite their redundancy, because the original functions were easy to understand and the new factored helper funtion is inscrutable. Context counts.