3 ms·
It depends. If it's not some core area of the code, but more like a script, some code that lives at the periphery, it might be better to "duplicate" almost simi
by arein3 3y ago
It depends. If it's not some core area of the code, but more like a script, some code that lives at the periphery, it might be better to "duplicate" almost similar code that is hard to abstract.
I saw attempts to remove "duplication" that made the code so hairy and hard to read, as opposed to very readable. I put duplication in quotes, because code might be similar, but not 100%.
Some code is easy to deduplicate.
Some code might be hard, and if the overengineering is done to remove 2 occurrences at some code periphery, is not worth it.