Multiple ChoiceBeginner 45s
Strategy vs state vs policy
A pricing component swaps interchangeable algorithms chosen by the caller, but it has no internal mode transitions. Which pattern fits best?
Options
- 1State: an object whose behavior changes by internal transitions between modes
- 2Template Method: a base class that fixes the algorithm skeleton
- 3Strategy: interchangeable algorithms selected externally with no self-managed state transitions
- 4Visitor: adding operations across a stable object structure
Think you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.