Switch statement considered harmful

Content:

Original link: The Dark Side of Switch-Case / Code That Makes Sense.

There are many cases where switch statement makes good sense.

But there are also many cases where it is a code smell. An indication that the overall design did not make everything work natural but that it all turns into a bunch of special cases.

There are those that claim that OOP is really "switch free programming", because the switch statements get replaced by object behavior.

Comments: