Click here to Skip to main content
15,909,440 members
Home / Discussions / C#
   

C#

 
GeneralRe: The Switch Statement Pin
Jammer13-Oct-08 9:26
Jammer13-Oct-08 9:26 
GeneralRe: The Switch Statement Pin
Vengatachalapathy Palanivel13-Oct-08 19:05
Vengatachalapathy Palanivel13-Oct-08 19:05 
GeneralRe: The Switch Statement Pin
Mark Salsbery13-Oct-08 20:23
Mark Salsbery13-Oct-08 20:23 
AnswerRe: The Switch Statement Pin
Wendelius13-Oct-08 8:41
mentorWendelius13-Oct-08 8:41 
AnswerRe: The Switch Statement Pin
PIEBALDconsult13-Oct-08 8:44
mvePIEBALDconsult13-Oct-08 8:44 
GeneralRe: The Switch Statement Pin
Guffa13-Oct-08 11:42
Guffa13-Oct-08 11:42 
GeneralRe: The Switch Statement Pin
PIEBALDconsult13-Oct-08 16:04
mvePIEBALDconsult13-Oct-08 16:04 
AnswerRe: The Switch Statement - Quality Anyone? Pin
carbon_golem13-Oct-08 10:05
carbon_golem13-Oct-08 10:05 
Not to beat the "dead horse" here, but I didn't see anyone bring up the induced complexity that the switch adds. See complexity definition here.[^] The higher the complexity score, the more trouble maintenance and testing become. The switch is very efficient at adding additional paths in the code (cases - 1).

While yes, the readability is there, one could argue at the same time a certain amount of flexibility is lost at the expense. There are more or less feasible ways around using a switch or bank of if/else altogether - using the chain-of-responsibility pattern has worked for me in some situations. And certainly it has made unit testing easier.

I might correct your colleague's statement and submit that maybe the architecture isn't "wrong" by using a switch, it just might be pointing out that there are higher quality alternatives.

Scott P.

"Simplicity carried to the extreme becomes elegance."
-Jon Franklin

GeneralRe: The Switch Statement - Quality Anyone? Pin
led mike13-Oct-08 10:08
led mike13-Oct-08 10:08 
GeneralRe: The Switch Statement - Quality Anyone? Pin
#realJSOP13-Oct-08 10:57
professional#realJSOP13-Oct-08 10:57 
AnswerRe: The Switch Statement [modified] Pin
led mike13-Oct-08 10:06
led mike13-Oct-08 10:06 
GeneralRe: The Switch Statement Pin
Mark Salsbery13-Oct-08 11:55
Mark Salsbery13-Oct-08 11:55 
GeneralRe: The Switch Statement Pin
led mike13-Oct-08 15:36
led mike13-Oct-08 15:36 
AnswerRe: The Switch Statement Pin
#realJSOP13-Oct-08 10:54
professional#realJSOP13-Oct-08 10:54 
GeneralRe: The Switch Statement Pin
Jammer13-Oct-08 11:01
Jammer13-Oct-08 11:01 
AnswerRe: The Switch Statement Pin
Guffa13-Oct-08 11:39
Guffa13-Oct-08 11:39 
AnswerRe: The Switch Statement Pin
Colin Angus Mackay13-Oct-08 12:05
Colin Angus Mackay13-Oct-08 12:05 
AnswerRe: The Switch Statement Pin
N a v a n e e t h13-Oct-08 16:07
N a v a n e e t h13-Oct-08 16:07 
QuestionThe GetDetailsOf() Method Pin
Ankit Rajpoot13-Oct-08 7:02
Ankit Rajpoot13-Oct-08 7:02 
AnswerRe: The GetDetailsOf() Method Pin
Dave Kreskowiak13-Oct-08 7:25
mveDave Kreskowiak13-Oct-08 7:25 
GeneralRe: The GetDetailsOf() Method Pin
Ankit Rajpoot13-Oct-08 7:30
Ankit Rajpoot13-Oct-08 7:30 
GeneralRe: The GetDetailsOf() Method Pin
Dave Kreskowiak13-Oct-08 9:07
mveDave Kreskowiak13-Oct-08 9:07 
Questionsave pdf on disk [modified] Pin
teddddddddddd13-Oct-08 5:11
teddddddddddd13-Oct-08 5:11 
Question.NET Remoting doesn't work with windows service but does with console application Pin
MegaBlasterX13-Oct-08 5:07
MegaBlasterX13-Oct-08 5:07 
AnswerRe: .NET Remoting doesn't work with windows service but does with console application Pin
Pedram Behroozi13-Oct-08 8:32
Pedram Behroozi13-Oct-08 8:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.