Strategy
Strategy pattern also known as policy pattern is a behavioral software design pattern that enables selecting an algorithm at runtime.
The idea is actually very simple. It's probably something you and I have been doing the whole time.
We have two types of engine and they both have different outputs depending on their displacement, torque curves and bunch of other details. We will have a Car
object which takes one of these two engines and Drive()
in runtime.
Last updated