Strategy: shipping options
Pick an algorithm at runtime without the caller knowing which one runs.
Level Intermediate
What you will see
- Two ways to ship, two ways to price
- One function, every rule
- A strategy is a function
- The context delegates
- Choosing a strategy
- When not to use it
Before / after
Base: strategy-base-goView the diff