23 classic GoF patterns

Creational (5): Factory Method, Abstract Factory, Builder, Prototype, Singleton

Structural (7): Adapter, Facade, Proxy, Decorator, Composite, Bridge, Flyweight

Behavioral (11): Strategy, Command, Observer, Iterator, Template Method, State, Chain of Responsibility, Mediator, Memento, Visitor, Interpreter

For our plan: we cover 22 of the GoF set (we skip Interpreter) + 10 Pythonic patterns → 32 total in this course.

# 32 patterns at a glance (one-liners, data-engineering flavored)

1. **Adapter** — Make unlike APIs look the same (e.g., S3/GCS/local all expose `Storage.put_bytes`).

2. **Strategy** — Swap algorithms at runtime (retry/backoff, sharding, serialization).

3. **Factory Method** — Subclass decides which connector to create (Snowflake: keypair vs OAuth).

4. **Abstract Factory** — Create families of related objects together (conn, cursor, uploader for each cloud).

5. **Builder** — Stepwise construction for complex things (SQL queries, ETL job specs).

6. **Prototype** — Clone configured templates cheaply (job configs with small tweaks).

7. **Singleton (avoid; use DI/module)** — Ensure a single shared thing (config/cache) without global tangles.

8. **Facade** — Simple front door over a messy subsystem (wrap multipart upload, ACLs, retries into two methods).

9. **Proxy** — Stand-in that controls access (auth, rate-limit, lazy init, network boundary).

10. **Decorator** — Add cross-cutting behavior at call sites (metrics, tracing, caching) without touching core logic.

11. **Composite** — Treat part/whole uniformly (pipeline = DAG of tasks; run `execute()` on both).

12. **Bridge** — Separate abstraction from implementation (Exporter API × {S3, Snowflake, BigQuery}).

13. **Flyweight** — Share heavy immutable state (schema/regex tables reused across many parsers).

14. **Command** — Package an operation as an object (DDL/maintenance tasks with queueing/undo).

15. **Observer** — Publish/subscribe on events (job finished → notify Slack, trigger next step).

16. **Iterator** — Standard traversal over sequences/streams (paged DB cursors); Python usually uses generators.

17. **Template Method** — Fixed skeleton with overridable hooks (extract → transform → load).

18. **State** — Behavior varies by internal state (job lifecycle: queued/running/failed).

19. **Chain of Responsibility** — Request flows through handlers (validate → enrich → mask → route).

20. **Mediator** — Central coordinator to reduce pairwise coupling (orchestrator ↔ many workers).

21. **Memento** — Capture/restore snapshots (pipeline run config/checkpoint for rollback).

22. **Visitor** — Add operations over a structure without changing it (walk SQL AST to rewrite/validate).

23. **Context Managers** — Reliable setup/teardown (`with transaction(): …`, temp creds, files).

24. **Generators/Iterators (Pythonic)** — Lazy pipelines, constant memory (stream S3 → gzip → JSON parser).

25. **Descriptors** — Reusable attribute behavior (validated settings, lazy fields, typed config).

26. **Lightweight DI** — Pass dependencies explicitly; small factories for easy tests/mocks.

27. **Plugin Discovery (entry points)** — Load connectors/processors at runtime without `if/elif` jungles.

28. **Caching Layers** — TTL/LRU/Redis around expensive I/O (schema fetch, secrets, pricing).

29. **Retry Policies** — Exponential backoff/jitter/limits for flaky networks (wrap HTTP/DB calls).

30. **Repository & Unit of Work** — Isolate persistence, batch commits, consistent transactions.

31. **CQRS-lite** — Separate read/write models for speed and clarity (OLTP writes, denormalized read views).

32. **Event-driven Callbacks** — Emit domain events and react asynchronously (queue/webhook based).