One of the means to achieve decoupling software modules is following Dependency Inversion Principle  (DIP). In this post I want to show how to implement the Strategy Design Pattern  in order to achieve Dependency Inversion. The basic idea behind Strategy is given that an algorithm, solving a particular problem, we define only skeleton of the algorithm at abstract level, but delegate specific algorithm’s implementation or some of its parts to another class or method. A client using algorithm may choose a specific implementation, while the general algorithm workflow remains the same.

#design-patterns #rustlang #object-oriented #rust #dependency-injection

Strategy Design Pattern in Rust
3.75 GEEK