nattyg
New Member
Code:switch x case 1: do crap that needs to be done to 1; case 2: do crap that needs to be done to 1 and 2; break;
It is very useful when dealing with stuff like commands and other things that tend to be either redundant or easily portable. In C# you might as well use nothing but if statements because case statements are broke.
Good pun at the end there...intended?
Quick summary on why...http://msdn2.microsoft.com/en-us/vcsharp/aa336815.aspx
I didn't read it *all* the way so if this point was made, forgive me...but it did touch on maintainability and large switch statements contribute to higher cyclomatic complexity which is typically a sign that something needs to be refactored, and again, points to potential problems in maintenance.
I'd argue that for commands in particular, you'd be better off at the very least utilizing an abstract factory which would drop the whole block down to a few lines of a code to obtain and execute the "command".
It's late...I can't sleep...so I troll.
trying to remember what I posted to one of our internal WoW communities a while ago (guess I didn't archive that email apparently...)
Code:
HAI
CAN HAS STDIO?
I HAS A IZUAHORDE
VISIBLE "IZ U A HORDE?"
GIMMEH IZUAHORDE
IZ IAZUAHORDE
YARLY
IM IN YR LOOP
VISIBLE "TAURENZ MAKE GOOD CHEEZEBURGERZ"
KTHX
NOWAI
VISIBLE "U CAN HAZ CHEEZEBURGERZ!"
KTHX
KTHXBYE
On that note...I think I may officially be sleepy! w00t! no more trolling and looking to stir up Microsoft trouble late at night! mwuahahahaha
I get the feeling my wife will be giving me this look in the morning...
Last edited: