7 comments

[ 4.4 ms ] story [ 28.7 ms ] thread
> 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...

Maybe "extreme over-architectured OOP" should be the new Goto.
If you're subclassing to dodge a simple switch you're in serious trouble.
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.
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.
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.
Goto isn't completely bad. It's used all over the FreeBSD kernel to bail out in error conditions.