Strategy: shipping options

Pick an algorithm at runtime without the caller knowing which one runs.

Level Intermediate

What you will see

  1. Two ways to ship, two ways to price
  2. One method, every rule
  3. One interface, many prices
  4. The context delegates
  5. Choosing a strategy
  6. When not to use it

Before / after

Base: strategy-base-tsView the diff

Exercises