Understanding the Strategy Pattern
A colleague of mine is currently trying to study and learn Design Patterns. For the uninitiated, the term Design Pattern often refers to a set of well-known patterns used to solve problems that often present themselves in software. The primary work was originally written by Gamma et. al in Design Patterns: Elements of Reusable Object-Oriented Software. My colleague was reading an article on the internet on the Strategy Pattern, and voiced frustration at how contrived the examples were in the article, and how this seems to be a recurring pattern (no pun intended) when we create content around Design Patterns for one another.
This post is my attempt to clarify information about the Strategy Pattern for my colleague, and my hope is that this effort will benefit a large audience of developers experiencing the same frustrations. Let’s get started.