

Switch should be the new Goto - clistctrl
http://www.stevenpwalsh.com/thoughts/2011/3/19/switch-should-be-the-new-goto.html

======
bhousel
Maybe "extreme over-architectured OOP" should be the new Goto.

~~~
astrodust
If you're subclassing to dodge a simple switch you're in serious trouble.

------
timrobinson
> _With proper sub-typing the implementation of the current execution path
> should be easier to read_

I'm not sure how the existence of virtual functions makes the execution path
_easier_ to read...

------
maratd
Errrr.... NO. The problem with goto is that it breaks the execution flow.
Switch doesn't do that. A switch statement is much easier to understand than
an army of if statements. Aside from personal conjectures, there isn't a
single argument provided against a construct that is found in every modern
programming language.

------
dko
It all boils down to the context that switch is used. And with the growing
popularity of loosely typed languages, it's probably not a good idea to make
such sweeping statements.

~~~
nathanlaan
Agreed. There are likely cases where using a switch statement is not the
optimal approah, but IMO saying that you should never use it over-generalizes.

------
ENOTTY
Goto isn't completely bad. It's used all over the FreeBSD kernel to bail out
in error conditions.

