3 ms·
sometimes it's better to copy and paste some code only to make each copy diverge more and more over time (somewhat like a starting template) as opposed to intro
by naringas 6y ago
sometimes it's better to copy and paste some code only to make each copy diverge more and more over time (somewhat like a starting template) as opposed to introduction an abstraction to generalize some slightly different behaviors only to use said abstraction twice.
this makes even more sense when the code will live on in different programs
there's a point when incurring the cognitive overhead costs of the abstraction become worthwhile, probably after the 3rd time. but my point is that it's also important to consider that the abstraction introduces some coupling between the parts of the code.
- rightbyte 6y agoI find it easier to read long functions of code than jumping around in helper functions or abstractions. Especially if I am not familiar with the code base and don't know common functions by heart.