News for hackers. Stuff that matters.
Re:That coworker who never stops refactoring by landryraccoon on Tuesday August 11, 2020 @10:54AM (#24120896)
Wow, you just blew my mind. "Don't Repeat Yourself" could just be premature optimization and overfitting on a tiny data set.
Re:That coworker who never stops refactoring by gsej on Wednesday August 12, 2020 @08:42AM (#24131448)
Absolutely. This has been discussed here quite a bit (e.g. https://news.ycombinator.com/item?id=120614530). In real life it's often visible when you have methods that take one or more flags to tell them how to behave. Fixing involves duplicating the method - one copy for calls where the flag is true, one for where it is false. Then simplifying, then repeating. The code that falls out at the end is often dramatically simpler than what was there before. It makes me wonder about some of these programming aphorisms - they only seem to work if you are already experienced enough to know to take them with a pinch of salt.
Re:That coworker who never stops refactoring by thehappypm on Wednesday August 12, 2020 @03:51PM (#24136063)
DRY is really valuable for noobs. Like, defining magic numbers twice in adjacent functions is really common behavior for beginners. Likewise, writing the same exact logic several times in different parts of the code without encapsulating into a function. Stuff that would be obvious for even junior devs.

But I do think it falls apart when applied at a more macro level.