The Strategy Pattern

strategy pattern class diagram

The GoF describe the strategy pattern as;

Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.

The strategy pattern enables you to use different rules or algorithms depending on the context they occur. For example in a system calculating the tax due on different assetts, different tax rules (algorithms) are used depending on the type of asset being considered.