5 ms·
Not sure why this is on the frontpage. Not only are there a bunch of typos, a bunch of code doesn't actually work the way they said it does. Also gotta love hat
by pech0rin 4y ago
Not sure why this is on the frontpage. Not only are there a bunch of typos, a bunch of code doesn't actually work the way they said it does. Also gotta love hating on the 10x developer or whatever for saying you are wrong.
EVERYTHING HAS TRADEOFFS. Every single thing has tradeoffs. Obviously you should not write terrible, brittle code. The reason DRY is important is because when you start duplicating code, having 30 different serialization methods littered throughout your code, 5 different ways of calculating the same value, etc etc you see why it really matters. Its a GUIDELINE used to as a general rule. And as guidelines and general rules go -- its useful for juniors and people who don't have the experience to see the best way to write the code.
Its a good default, and like YAGNI, and 100 other programmer acronyms it has its ups and downs. Your pizza example is not "coincidental repetition" -- it is actual repetition -- you just abstracted it in a really poor way to make a strawman.
- misja111 4y agoThis. The clean code principles should be considered within the specific context of the situation. They are guidelines that are good to keep in mind, but no more than that. The article gets this wrong by considering DRY as some kind of dogma and then discovering some situations where it doesn't work well. And then of course some commenters here get it wrong by only looking at situations were it does work well. It's the same religious discussion again as FP vs OOP, static vs dynamic typing, no code vs full code etc. etc. The real answer to each of these is always 'it depends'.
- fuzzy2 4y ago> They are guidelines that are good to keep in mind, but no more than that. How great dev life could be if everyone saw it like that.
- fastball 4y agoYeah, this reads like a junior programmer that got told off for having very repetitive code and they're trying to get the internet to agree that they're in the right and DRY isn't all it's cracked up to be. From the about page it doesn't seem like this is accurate, but that's how it reads. The problem is that he made his case poorly and I definitely don't agree.
- pydry 4y ago>EVERYTHING HAS TRADEOFFS. Every single thing has tradeoffs This should be the lede, IMHO.
- willbw 4y agoCompletely agree. This is a low quality blog post.
- ArrayBoundCheck 4y ago> EVERYTHING HAS TRADEOFFS Bullshit. What's the tradeoff on using `gets` vs any other function? Nothing. Absolutely nothing. `gets` is wrong 100% of the time period. If you're wrong its not a trade and a lot of things in this article and about dry is wrong
- ggregoire 4y ago> Not sure why this is on the frontpage. Not enough people are flagging the post.
- jasonm23 4y agoClick bait. Please avoid and don't engage the post.