Observer

Observer cuts coupling through a one-to-many relationship that notifies subscribers of state changes. The Subject just notifies, unaware of who listens. EventEmitter, RxJS, and event-driven architecture all extend from here. It differs from broker-mediated pub/sub.

March 17, 2024 · 3 min read

Strategy

Strategy encapsulates a family of algorithms behind a single interface and swaps them at runtime. It extends by adding a strategy instead of editing an if/switch. In languages with first-class functions, a separate Strategy class collapses into a single function.

March 3, 2024 · 4 min read