Design Patterns – The Strategy Pattern

Even though design patterns exist to make the life of a software developer/programmer easier, they present a learning curve for those not practiced in this area.

The problem with patterns is that there exist so many of them. Speak to any talented software developer and ask him/her about design patterns and they’ll probably quote the “Singleton,” “Model View Controller,” “Command,” or “Observer” patterns because these are most common, but many more patterns exist. Microsoft has reams of online documentation dedicated to patterns, and the Java SDK is built atop of a series of the best used patterns. So it is no surprise that software developers not practiced in the area shy away from design patterns and stick to traditional ad-hoc methods of software architecture and implementation. The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. In English – this pattern describes a way to abstract out most commonly changing code from code that never changes and encapsulate this commonly changing code so that it can be used or interchanged with other similar code to provide behavior like functionality.