๐Ÿ Design Patterns with Python
Home Chapters Examples Diagrams Bibliography GitHub โ†—
  1. Home
  2. Coordinating and Traversing
Part 8 4 chapters

Coordinating and Traversing

Observer, Mediator and Chain of Responsibility, Iterator through generators and the iterator protocol, and Visitor, Memento, and Interpreter.

Chapter 22

Observer

An Observer is a callable, but the delivery contract is still a design: subscription order, failure isolation, events published during delivery, and how long a signal keeps a subscriber alive.

Read โ†’
Chapter 23

Mediator and Chain of Responsibility

A chain of responsibility is a tuple of callables, but the order of its stages and the final stage are still choices you make. A mediator keeps the rule for releasing a declaration, once its duty and inspection reports have arrived, in one place.

Read โ†’
Chapter 24

Iterator: generators and the iterator protocol

A generator replaces the cursor class, but one pass or many, how much to read and who closes the source are decisions the language leaves to you.

Read โ†’
Chapter 25

Visitor, Memento, and Interpreter

Visitor dissolves into a match over a closed union, while a snapshot and a tariff tree stay design: what to capture, what mustn't roll back, and the readings of one grammar.

Read โ†’
โ† Previous part Composing and Adapting Structure Next part โ†’ Idiomatic Python
Design Patterns with Python
Prose, diagrams and decks: CC BY 4.0. Sample code: Apache 2.0.
Source on GitHub โ†—  ยท  File an issue โ†—