YEah ... no.

Also the examples given are wrong to the core.

if (something) throw Eception

else ...

wtf? In what universe / language do you need an else after a throw? If the code moves forward following the throw, you need (at most) another if, but no else.

Yeah, you never need an else and there's no need of an else even in your example, but the solution is to simply delete them and (maybe) keep the if's unless you're breaking the S in SOLID.

Replace 3 if's with a state machine is premature optimisation (oh, maybe one day we will need more ... sure).

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store