A design pattern that extracts an algorithm as an interchangeable component that can be swapped out at runtime.
By implementing logic that would otherwise be handled with conditional branches (if statements)—such as a discount calculation or a sorting method—as independent classes (strategies), you can add a new strategy without modifying existing code (the open/closed principle).
© 2026 ITBGM