ReviseAlgo Logo

Design Patterns in Python

Strategy Pattern

Swapping algorithms at runtime

Interview: Design interviews — very common

Strategy

The Strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. The client can choose any strategy without changing its code.