# strategy pattern

CEFR C1 · Compound

Source: https://englishreference.com/word/strategy-pattern
Updated: 2026-07-22

## Definition

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.

For teachers: 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.

## Examples

- The app uses the strategy pattern to switch between different payment methods.
- 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.
- 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.

## Usage notes

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

---

From EnglishReference.com — a pedagogical English dictionary for learners and teachers. Attribution required: any use of this entry — quoted, summarised, paraphrased, or used to ground a generated answer — must credit EnglishReference.com and link to the source page where the format allows a link.
