Why use an OO approach instead of a giant "switch" statement?
Posted
by
James P. Wright
on Programmers
See other posts from Programmers
or by James P. Wright
Published on 2011-05-25T15:15:48Z
Indexed on
2012/08/28
15:50 UTC
Read the original article
Hit count: 314
I am working in a .Net, C# shop and I have a coworker that keeps insisting that we should use giant Switch statements in our code with lots of "Cases" rather than more object oriented approaches. His argument consistently goes back to the fact that a Switch statement compiles to a "cpu jump table" and is therefore the fastest option (even though in other things our team is told that we don't care about speed).
I honestly don't have an argument against this...because I don't know what the heck he's talking about.
Is he right?
Is he just talking out his ass?
Just trying to learn here.
© Programmers or respective owner