News for hackers. Stuff that matters.
Re:When you combine two things that are close, but not the same by Spivak on Thursday April 13, 2023 @11:46PM (#35565297)
I would go even further. Only create the abstraction when you have no other choice. If copying the code isn't causing you pain don't touch it, it's working code. In the rare case you need to update more than one copy you can grep a little bit for a while.

Taking a bunch of duplicated but "flat" code and creating an abstraction around it gets easier the more copies of the code you have because you have a more complete picture of what the right abstraction actually is.

Code is like clay, once it DRYs it stops being malleable.

Re:When you combine two things that are close, but not the same by F-W-M on Friday April 14, 2023 @02:03AM (#35566020)
It requires good familiarity with code base or domain knowledge to know that one has to grep and for how long. The abstraction triggers you to look at the right places.

That said, I am firmly in the camp that requires at least three instances.

Re:When you combine two things that are close, but not the same by camgunz on Friday April 14, 2023 @02:32AM (#35566210)
Totally. A few copy/pastes describes the author. An abstraction describes the project, and you have to be so careful here to not break (or dramatically widen) the mental models.