- Aug 8, 2017
- 571
- 820
There are some valid reasons/criticism. Like daisy-chaining them to the point where the code is hard to follow (though, sometimes that is unavoidable). Or writing if conditions within if conditions where the 2 conditions don't need to be separated. Or when a bunch of the conditions end in the same result.I'm also extremely curious why they think that if-else approach is somehow bad.
Usually when such objections are raised you end up looking at an "alternative" that's a clusterchuckle of self-references and recursions, because procedural programming is so last century /s
But a lot of the knee-jerk responses to if-else statements being "overly used", in my experience, is just as you said. Like, we like to think (and I certainly did) that programming is a field base off of logic and reasoning. But there's A LOT of politics to be found in it. People insisting their new way of doing things is the better way because reasons or they want clout or they want to sell you something. Like, this is why they tried to embed blockchain and crypto into "web 3.0". (which, again, is a marketing term. There's no technology that enhances/changes the fundamental way we're view HTML and run HTTP defined "web 3.0") This is why I picked up on that post so quickly. A lot of people like to pretend they know coding on the internet for some reason but don't (Like, look at Elon Musk). And they tend to make statements like that that makes them stick out like a sour thumb.
My last point/tangent so I don't keep going off topic. I once watched a video on someone trying to push that object oriented programming is bad and how we should all stick to naming/bundling all functions like:
class1_run();
class2_run();
And so many comments were like, "This is GENIUS!" And I had to go like, "Uhhh, no. We've tried this. People use to do this prior to OOP. It was bad. It was really bad. This is why we invented OOP."