strategy pattern
Swapping in different behavior by passing a different object that implements the same interface.
The strategy pattern encapsulates interchangeable algorithms behind a common interface so callers can choose one at run time.
Examples
Checkout takes an
IShippingRule, and passingnew FlatRate()ornew FreeOverFifty()changes how shipping is priced without touching checkout.
See also