News for hackers. Stuff that matters.
Re:“What if it changes?” by fauigerzigerk on Monday May 23, 2022 @04:23AM (#31476518)
I agree that counting the number of times you repeat yourself is not the right metric to determine whether or not to introduce an abstraction. Abstraction is not compression. But I don't think it depends on how simple any abstraction would be either. Simplicity does play a role for pragmatic reasons of course but it's not the key question in this case.

The key question is whether there is a functional dependency or just a similarity between some lines of code. If there is a functional dependency, it should be modeled as such the first time it is repeated. If there is only coincidental similarity then introducing a dependency is simply incorrect, regardless of how often any code happens to get repeated.

Re:“What if it changes?” by zelphirkalt on Monday May 23, 2022 @05:20AM (#31476812)
I agree! Maybe one could say: Not all repetitions are of equal nature in terms of what causes them, and to understand the cause is important.