Poppycock and balderdash. Even your initial code snippet is either card stacked, or just plain illustrates you don't know enough about code efficiency to write an article like this.
Since, well... you went full Pakled and put
THROW. Do you see the problem there? That's as stupid as using
... and your answer to make it "simpler" is to use ten times or more the code, introduce endless pointless function/method call overhead resulting in memory thrashing and banging the brakes on execution speed, and spreading it all out all over creation so nobody can even find where any of the logic is even actually being run?
See folks, this is EXACTLY the type of nonsensical rubbish I'm talking about where people are pissing on websites with megabytes of code for things that don't even warrant double digit K of it.
THEN they claim it's all magically somehow "easier" or "better"... and if you call them on it they dive for lame excuses and half-assed assumptions that you've "never worked on a large codebase" or "large project".
That "messy branching code" is nothing compared to the full Gungan train wreck laundry list of how NOT to structure code for performance or ease of maintenance. To be brutally frank that MESS of classes for nothing, far calls for nothing, and all the rest of the "objects for everything" asshattery is a poster child for everything wrong with development right now.
What the blazes ever happened to "the less code you use, the less there is to break"... All I can hope is that the people who pull these types of pointless convoluted cryptic bloated stunts will keep it to themselves server-side, and not take a giant dump on the client-side with this type of ignorant incompetent trash.
Anyone who thinks this mess of ten to twenty times the code is “more readable” likely shouldn’t be programming in the first place.
But let me tell you what I really think. This is the type of junk that when I get called in as an accessibility and usability consultant for, I end up having to rip out wholesale and then get people fired over when they start spewing out the nonsensical gibberish lame excuses if not outright bald-faced LIES as to why using ten to twenty times the code is “better” or “easier”.
You REALLY think that’s simpler and easier? On what planet and in which reality?