
If-Else Is Bad Programming Practice in Modern Code - kiyanwang
https://levelup.gitconnected.com/if-else-is-a-poor-mans-polymorphism-ab0b333b7265
======
lioeters
> The art of turning 6 lines into 92 lines by replacing if-then-else and
> switch with objects..

> ..In summary, traditional branching is often a student’s tool until a more
> suitable, polymorphic approach is discovered.

I can't tell if this is serious or a straight-faced joke. The article did not
convince me at all - in fact it dissuaded me further from the kind of approach
taken, which I often encounter in the wild: a class for every condition, with
slightly differing implementations.

A similarly questionable article was posted a couple days ago:

Anti-IF Framework - [https://blog.arkency.com/anti-if-framework---if-slash-
else-b...](https://blog.arkency.com/anti-if-framework---if-slash-else-based-
on-type/)

------
bccdee
I honestly thought that this article was satire until I reached the end &
found no punchline. This is a fast way to turn any codebase into a mess of
unreadable action-at-a-distance nonsense. I don't have any beef with objects
or classes, but it's appalling how some people will use them to obfuscate
clear code by splitting an if statement over several files.

