1. The Pain Came First

Everyone knows this. You open a class and there it is: the if-else chain. Twenty branches. Thirty. Some with comments like // TODO: refactor from 2019. You know you shouldn't touch anything — side effects, unknown dependencies, missing tests. So you add your case. At the bottom. After the last else.

And you go home with that bad feeling that you've become part of the problem.

2. My First Attempt — And Why It Didn't Make Me Happy

Eventually, I'd had enough. I refactored the if-else chain using an enum pattern: