Back to list
Views:   0
Replies:  0
Reply 1
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
Robert Blixt, Mar 29, 2011
any other brief description about clone() and copy() string methods.
Dec 07, 2010
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas