Re:I don’t buy “duplication is cheaper than the wrong abstra...
by Kapura on Tuesday August 29, 2023 @03:11PM
(#37312427)
so your argument is, "you've got to write functions, therefore abstraction is always good" ?
yeah man i don't start in main() and never write another function ever again. You got me. But I also don't aggressively police duplication, accepting that I would always rather see what's happening without file-hopping. The correct abstractions will simplify code, and they will seem obvious (even if just in retrospect). Abstractions that force me to continually re-frame the problem i am trying to solve in terms of another's use case are antithetical to writing the sort of code that I do.
Re:I don’t buy “duplication is cheaper than the wrong abstra...
by wvenable on Tuesday August 29, 2023 @03:19PM
(#37312535)
You don't have to write functions. Have you ever seen a 10,000 line code that was just a single function -- I have. It also had nested if statements 5 levels deep to handle all sorts of logic with lots of duplication. It was unmaintainable. Yet it did meaningful work and it could have been refactored to a fraction of the size and do the same work. But, to be honest, when I had to fix it I just went it and fixed in the 20 places that needed changing because it was impossible to follow.
You like good abstractions and you hate bad abstractions. I couldn't agree with that more.
Abstraction can be as simple as a function.
It seems odd to give really good examples of abstraction and then sort of do a No true Scotsman argument on it. "It can't be abstraction because it's not terrible."