Very true!

That's exactly what I'm on about here.

There're too many examples in the wild doing crazy nested if-else branching when it could have been handled elegantly with the State pattern.

I know this article will upset a lot of if-else fanboiz. That's kinda the purpose.

Refactoring to State pattern is just one way to remove if-else branching. There're many other ways, depending on the concrete situation and goal.

MSc. | Tech writer with +1M views. Sharing my opinion and what I learn. .NET backend engineer, ex big4 SC. New YouTube Channel https://bit.ly/3vxqNHj

MSc. | Tech writer with +1M views. Sharing my opinion and what I learn. .NET backend engineer, ex big4 SC. New YouTube Channel https://bit.ly/3vxqNHj