Simple, real life examples in C++.
The repository contains easy to understand design patterns code examples in C++. It is a great start for anyone who would like to get familiar with best software engineering practices.
First - clone the repo. Due to some dependencies in examples, you may need to manually install some additional packages. Visit the desired pattern section to get more instructions.
Strategy defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from the clients that use it. It captures the abstraction in an interface and buries implementation details in derived classes.
- Inheritance binds algorithm with the client code, which makes understanding, conservation and extending more painful (maintenance over faster ‘greenfield’ development)
- Algorithms (that change, rise & disappear) encapsulated and splitted from the client code
- Removed ‘if’ statements
- Implementation can be set (even dynamically)
the command
The code in this project is licensed under MIT license.