Selecting and Varying Behavior
Strategy, Template Method with non-virtual interface, State and finite-state machines (including probabilistic ones), and Command with undo and command queues.
Strategy
Three idiomatic C++ ways to select a varying algorithm at runtime or compile time, taught against a real shipping-rate example: an abstract interface behind a unique_ptr, a std::function value, and a compile-time policy constrained by a concept.
Template Method and the non-virtual interface
A fixed algorithm skeleton that calls private virtual hooks for the steps that vary, taught against an order export pipeline that produces a CSV manifest, newline-delimited JSON, and a fixed-width EDI feed from the same five-step sequence, with the non-virtual interface idiom protecting the sequence itself from every subclass.
State and finite state machines
A shipment's lifecycle modeled four ways: the GoF State pattern with one type per status, a data-driven enum-plus-transition-table machine, a std::variant dispatched with std::visit, and a probability-driven machine whose weighted transitions are made reproducible by injecting a seeded random engine.
Command, undo, and command queues
Turning a warehouse editor's operations into Command objects with their own execute and undo, an undo/redo stack that steps back and forward through a session, a FIFO queue that defers and batches execution, and the std::function shortcut for a queued action with nothing to undo.