Back To Schedule

The Strategy Design Pattern

18:00 - 19:00 Saturday 2nd March 2024 UTC
Beginner
Design

The strategy design pattern is a fundamental behavioral design pattern allowing clients to control the behavior of an object at run-time. The strategy pattern can be seen in action in the C++ STL for example applying 'policies' to how to execute operations (e.g. std::par or std::seq as one example) -- thus strategy is often known as the 'policy pattern' as well. The strategy design pattern is commonly used to choose the algorithm at run-time to best solve a problem -- separating the algorithmic behavior from the object itself to help make our software more maintainable, extensible, and flexible. In this talk, we will look at a series of C++ examples (starting from scratch) of using the strategy pattern to deploy different algorithms at run-time. We will also look at examples of code in libraries deploying the strategy pattern, and talk about best practices for using the strategy pattern in Modern C++. The strategy pattern will also be compared to the Template Method Pattern, which may be an alternative choice. Attendees will leave this talk with the knowledge to go forward and implement the strategy pattern, as well as how to spot the strategy design pattern in projects they may already be working on!

View Slides

Mike Shah

Mike is currently an Associate Teaching Professor at Northeastern University in the Khoury College of Computer Sciences. His primary teaching interests are in computer systems, computer graphics, and software engineering. His research interests are related to performance engineering (dynamic analysis), software visualization, and computer graphics.

Along with teaching and research work, Mike has juggled occasional consulting work as a 3D Senior Graphics Engineer in C++. Mike also has a YouTube channel with lots of programming content at: https://youtube.com/c/MikeShah . Outside of work, you'll find Mike perfecting the art of making pizza, or otherwise on a run.