1,128
99.9
Mar 29, 2011
I believe it's good thing that if you use/see a switch statement, consider if there are better alternatives using Strategy, State, or Factory. As I believe that using those patterns will make your code more robust and easier to maintain and change.
However, not all situations require patterns. As with switch statements, sometimes it would be easier to use the switch statements instead of implementing a full-blown pattern. I guess it depends on the situation and more specifically if you anticipate that the switch statement would be changed in the future (added conditionals, etc). Bare in mind that most often, when you use patterns, your code will become more complex and you should consider if it is worth it.
It is always a trade off :)
Good Luck