3 ms·
Having specialized in project rescue, touring all over "the industry", you can't possibly make that generalization. For every purported best practice, there ar
by swatcoder 2y ago
Having specialized in project rescue, touring all over "the industry", you can't possibly make that generalization.
For every purported best practice, there are teams/orgs that painted themselves into a corner by getting carried away and others that really would have benefited from applying it more than they did.
In the case of DRY, it's an especially accessible best practice for inexperienced developers and the project leads many of them become. Many many teams do get carried away, mistaking "these two blocks of code have the same characters in the same sequence" with "these two delicate blocks of code are doing the same thing and will likely continue to do so"
Having advice articles floating around on both sides of practices like this helps developers and teams find the guidance that will get them from where they are to where they need to be.
Context, nuance, etc, etc
- PaulHoule 2y agoIf that's what they wanted to prove they should have shown a better example.
- swatcoder 2y agoThat's fair. I think the insight/concept behind the essay is sound, but I agree that the example (and writing) could be a lot better.
- AnimalMuppet 2y agoIn Zion National Park, there's a hike called Angel's Landing. For part of the hike, you go along this ridge, where on one side you have a cliff of 500 feet straight down, and on the other side, you have a cliff of 1000 feet straight down. And in places, the ridge is only a couple of feet wide. Best practices can be like that. "Here's something to avoid!" "OK, I'll back far away from that." Yeah, but there's another cliff behind you, of the opposite error that is also waiting to wreck your code base. Listen to best practices. Don't apply them dogmatically, or without good judgment.
- ric2b 2y agoDRY should honestly just be restated as "Avoid multiple source of truth", two pieces of code that look similar but have two separate goals are not something that falls under DRY unless you can pull out some common logic that actually is the same goal and can become the single source of truth for that goal.