When to use it:
- When you have a family of algorithms that do the same thing, but in a different way.
- When you want decouple the client usage from the actual implementation.
- Is a good alternative for a inheritance because it brings more flexibility horizontally in the Inheritage Tree.
- Capture the abstraction into an interface, and the implementation into concrete classes.
References:
- Youtube Christopher Okhravi
- Github Qian Mo
- Article Source Making
- Article Guru
Sorting Agorithms in the example are taken from: