
Why does everyone love polymorphism over switch case - ayroblu
https://stackoverflow.com/questions/63732704/polymorphism-versus-switch-case-tradeoffs
======
mimixco
Personally, I agree with the author. Since code executes linearly (in a
single-threaded app), it makes sense to write it that way, too. We recently
wrote a large a complex parser, interpreter, and backing database for a new
text processing language we're developing and it was done entirely without
classes or OOPS-type constructs. As the author suggests, it's mostly a lot of
switch/case (or in our case, lisp cond expressions) that test for and handle
the various cases that the parser might encounter, much as a human would.
We've found this design much easier to reason about and debug than a bunch of
classes that depend on each other.

