strategy pattern
A strategy supplies interchangeable behavior behind a shared contract.
Use this when The same workflow supports several algorithms or output formats.
without the term
“Export has if csv do this, if json do that, if xlsx do this, scattered all over. Every new format means editing five files. Can you make formats pluggable?”
with the term · How do you ask a model for strategy pattern?
Use interchangeable strategies for these export formats. Verify a third writer can be added without changing the workflow’s callers.
What is strategy pattern?
Each variant implements the same small contract, such as a function that writes one export format. The workflow calls the contract without checking which variant it has.
Why does strategy pattern matter when vibe coding?
Scattered mode checks make each new variant a change across many callers.
How do you do strategy pattern?
Extract the varying behavior and verify callers against more than one implementation.
What goes wrong with strategy pattern?
Building a class hierarchy when a small function parameter would express the variation.