ENGLISH
REFERENCE

strategy pattern

compound.
C1 Advanced Software Architecture
Definition

compound. a way of writing computer code that lets you choose between different methods for doing a task while the program is running. Instead of using one fixed method, you can swap in a new one easily.

compound. a behavioural design pattern that enables selecting an algorithm's behaviour at runtime. It defines a family of algorithms, encapsulates each one, and makes them interchangeable, allowing the algorithm to vary independently from clients that use it.


SIMPLE

The app uses the strategy pattern to switch between different payment methods.

CONTEXTUAL

By implementing the strategy pattern, the developers allowed the navigation software to switch between 'fastest route' and 'shortest distance' logic without changing the core code.

COMPLEX

The strategy pattern promotes the Open/Closed Principle by allowing new algorithms to be introduced into a system without necessitating modifications to the existing context class that consumes them.

Origin

A compound of the military-derived strategy, from the Greek stratēgia, and pattern. The term was formalised in the software engineering context by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides in 1994.

Etymology adapted from Wiktionary, available under CC BY-SA 4.0.

Usage

Commonly used in object-oriented programming; typically involves an interface for the strategy and concrete classes for each specific implementation.

Last updated July 22, 2026