The Strategy Pattern

archetype Military CommandObject-Oriented Design

Categories: software-engineering

What It Brings

Strategy is a general’s art: choosing among alternative plans of action based on terrain, enemy disposition, available forces, and objectives. The GoF Strategy pattern maps this onto software: a family of algorithms is encapsulated in interchangeable objects, and the client selects which one to deploy at runtime. The military metaphor frames algorithm selection as tactical decision-making — you don’t hardcode your approach, you choose the right plan for the situation.

Key structural parallels:

Where It Breaks

Expressions

Origin Story

The word “strategy” comes from the Greek strategia (“office of a general”), from strategos (“general”), itself from stratos (“army”) and agein (“to lead”). The GoF Strategy pattern (1994) chose this name to capture the idea of selecting among alternative approaches to achieve the same objective. The military origin is still active in developer discourse — people speak of “choosing a strategy” and “deploying” algorithms in ways that echo tactical planning. But the pattern’s most common uses (sorting strategies, validation strategies, pricing strategies) have drifted far from the battlefield. “Strategy” in business and game theory has softened the military edge, and many developers encounter the word first in non-military contexts.

References

Related Mappings