How to isolate different variants of an algorithm within an object using the Strategy Pattern

The Strategy Pattern is a popular design pattern used to organize as well as and encapsulate algorithms. This pattern is used when is necessary to isolate the business logic of a class from algorithm implementation details that may not be as important in the context of that logic.

What is Strategy?

The authors of the book Design Patterns: Elements of Reusable Object-Oriented Software define the Strategy Pattern as follows:

The Strategy pattern is to be used where we want to…










Cesar William Alvarenga

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store