This is a sample, in Java, of how to apply the Strategy Pattern in your project.
It was used engine roar and headlights as behaviors that change from car to car.
Interfaces (strategy)
- EngineRoar (roar)
- HeadLight (turn on and turn off)
EngineRoar, HeadLight folders (Concrete Strategy)
Main (Context)
Strategy defines a family of algorithms, encapsulates each of them and makes them interchangeable. It allows the algorithm to vary independently of the clients that use it.