2 ms·
In my experience: don’t worry about duplication. It’s sometimes OK and sometimes a Symptom. Don’t fix the Symptom, fix the main cause: Classes or functions tha
by quickthrower2 7y ago
In my experience: don’t worry about duplication. It’s sometimes OK and sometimes a Symptom. Don’t fix the Symptom, fix the main cause:
Classes or functions that do more than one thing. The definition of one thing is one conceptual thing.
For example I’ve seen DTO objects with both wire concerns and Ui concerns. Splitting that out made a lot of code simpler and incidentally deduped some stuff.
So attack poor abstractions, not duplication. The S.O.L.I.D principle is a good start (even for non OO code)
If you are unsure, I’d always err on keeping the code as is, you can always refactor it tomorrow when you understand more. Instead: make sure the unit test coverage is adequate.