Practical Programming Example
Refactoring Your Switch to Ad-Hoc Polymorphism for Better Code Quality
You’ll rarely ever need to branch on a discrete value.
Published in
5 min readOct 30, 2021
I’ve mentioned this a tonne already, and this won’t be my last, but branching on discrete values using switch cases and if-else statements is often a terrible idea.