3 ms·
> especially the same pattern of branching in several places - then you should certainly consider replacing that with polymorphism As a first step, I'd say bet
by hellofunk 8y ago
> especially the same pattern of branching in several places - then you should certainly consider replacing that with polymorphism
As a first step, I'd say better to just isolate the branching in one place, as a separate function, rather than immediately jump to polymorphism which could have high refactoring costs in some cases (even if it might eventually be worth it).
Because premature abstraction is just as bad as premature optimization.