Strategy Pattern
This lesson discusses how a set of policies, algorithms or strategies can be made interchangeable without affecting the clients using them.
We'll cover the following
What is it ?
The strategy pattern is one of the simpler patterns to comprehend. It allows grouping related algorithms under an abstraction, which the client codes against. The abstraction allows switching out one algorithm or policy for another without modifying the client.
The strategy pattern is formally defined as encapsulating algorithms belonging to the same family and making them interchangeable. The consumers of the common interface that the algorithms implement allow switching out one algorithm for another seamlessly.
Get hands-on with 1400+ tech skills courses.