By alashcraft
via elegantcode.com
Published: Jan 12 2009 / 01:58
Switch, select, case, really long if statement…whatever the cause, when they get too long they all become unmanageable. Overly long switch statements do exists, I’ve written them, we have all seen them in other peoples code. In fact, I remember hearing, from a fellow Elegant Coder, that a coworker of his hit the limit for how many cases can be in a .Net switch statement. I don’t remember what the limit was, but it was a lot, and they exceeded that number.
Tweet
SaveShareSend
Tags: .net, frameworks, how-to, methodology
Comments
cristian.malinescu replied ago:
Neither splitting into multiple methods or polymorphism is the right solution. The right solution is the *Strategy Pattern*.
Voters For This Link (9)
Voters Against This Link (2)