Skip to main content

Structural patterns with executable contracts

This required extension follows the original Factory, Builder, Adapter, Decorator and composition-root lessons. It replaces the former two-hour quote-wrapper lab with an 18–26 hour package: instruction and trace practice 6–8, lab and design evidence 8–12, assessment and delayed repair 4–6. Do not double-count the old exercise. Original broader pattern practice remains required; the workload ledger budgets the full module at 65–95 hours and includes this package once.

Learning sequence​

  1. Adapter meaning and validation.
  2. Wrapper order and retries.
  3. Construction and ownership.
  4. Practice, lab and independent gates.

The fake quote provider has no network or side effects. This is a synchronous, in-memory teaching package, not payment software, a retry framework or a general currency library. Its input grammar and resource assumptions are deliberately explicit.

Selective sources​

Full-book reading is not required. Reuse the existing reading guide for GoF and Head First discussions of the relevant patterns. No purchase or book conversion is needed.

  • Python decimal documentation: focus on string construction, context precision and as_integer_ratio. Contrast exact input representation with potentially rounded arithmetic.
  • Python contextlib and ExitStack: inspect reverse-order cleanup, partial construction and exception propagation. The lab permits these standard-library tools; rebuilding them is not the learning objective.
  • Reuse behavioral failure boundaries before extending retries to external effects.

Primary source pages checked on 2026-10-23. Local code and teaching examples are original. Independent technical review and learner calibration remain pending.