Strategy, Decorator and Adapter

Three C# classes behind one interface, and what each does with the same call.

Strategy, Decorator and Adapter behind one IShippingCost call (interactive map)

One call site and one IShippingCost, and three things on the other side of it. Strategy swaps which body answers. Decorator stacks layers that each hold another IShippingCost, so a cache hit returns from two layers in and the courier is never called. Adapter is the innermost layer, and the only file that knows Kestrel exists.

← All cheatsheets