The strategy pattern is useful for situations where it is necessary to dynamically swap the algorithms used in an application. The strategy pattern is intended to provide a means to define a family of algorithms, encapsulate each one as an object, and make them interchangeable. The strategy pattern lets the algorithms vary independently from clients that use them.
The Strategy Pattern consists of strategies, which are the interchangeable classes which encapsulate variants of a particular algorithm, and the context class, which utilizes these strategies. The context can choose different strategies at runtime depending on the situation.

Here is an example implementation of the Strategy Pattern: