Skip to content

Strategy

Stable ID: pattern.strategy
Kind: design-pattern
Status: stable
Source: skill/references/design-patterns/strategy.md

Purpose

Encapsulate a real algorithm or policy variation behind an explicit interchangeable contract.

Use when

  • Callers select among multiple policies with the same purpose.
  • The variation changes independently from orchestration.

Avoid when

  • Only one implementation exists and no external seam requires variation.
  • A function parameter or simple callable is clearer.

Applicability

  • Languages: any, python, q-kdbplus, cpp, rust, dart-flutter, typescript
  • Related entries: decision.strategy-vs-function, component.retry