what if DRY is wrong, even in the "single source of truth" sense? So many of our tools for program correctness are, essentially, about overlapping and redundant "sources of truth" -- type definitions, tests, contracts all verify your code's "truth" by duplicating some part of ithttps://twitter.com/rtfeldman/status/1092885754265489408 …
-
Show this thread
-
Replying to @modernserf
That's an interesting thread to pursue but at minimum there would need to be editor support for keeping track of repeated pieces of code and changing (some of) them in tandem, because that is maddening otherwise.
2 replies 0 retweets 0 likes -
Replying to @rplevy
What do you mean? Duplication is how everything works *now*, and the difficulty of making modifications (vs wholesale replacements) is what makes it useful
1 reply 0 retweets 0 likes -
Replying to @modernserf
If the same duplicated piece of code needs to be edited in multiple places when it changes it's a huge pain.
2 replies 0 retweets 0 likes -
Replying to @rplevy @modernserf
The opposite problem is also bad though. When a piece of code is DRY and shared by 30+ things, and you need to change it for only 3 of those things. Particularly bad if you don't know what calls the function. A change is then potentially breaking for many unknown things.
1 reply 0 retweets 0 likes -
Replying to @sebinsua @modernserf
I think that underlines the wisdom of keeping functions single-purpose. If there's a variant on that purpose it should be a distinct function.
1 reply 0 retweets 0 likes -
Replying to @rplevy @modernserf
What I mean is that somebody can fix a function, and think that their change is just an implementation detail. If it turns out that it is a breaking change it can cause bugs in the N callers that had different expectations of the function's behaviour.
2 replies 0 retweets 1 like
Bugs are a much worse problem than duplication. DRY can be done, but you need to be careful about the consumers of the API. No semver here and every caller shares the same version of the code. So no guarantees that a change won't cause problems unless you test well.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.