Thinking in Python, Revision 0.1 -- Incomplete and Unfinished - Contents
Thinking in Python, Revision 0.1 -- Incomplete and Unfinished - Title Page
Preface
Introduction
The Y2K syndrome
Context and composition
The pattern concept
What is a pattern?
Pattern taxonomy
Design Structures
Design principles
The Singleton
Exercise:
Classifying patterns
The development challenge
Exercises
2: Unit Testing
Write tests first
Simple Python testing
A very simple framework
Writing tests
White-box & black-box tests
Running tests
Automatically executing tests
Exercises
3: Building application frameworks
Template method
Exercises
4:Fronting for an implementation
Proxy
State
StateMachine
Table-Driven State Machine
The State class
Conditions for transition
Transition actions
The table
The basic machine
Simple vending machine
Testing the machine
Tools
Exercises
X: Decorators: dynamic type selection
Basic decorator structure
A coffee example
Class for each combination
The decorator approach
Compromise
Other considerations
Exercises
Y: Iterators: decoupling algorithms from containers
Type-safe iterators
5: Factories: encapsulating object creation
Simple Factory method
Polymorphic factories
Abstract factories
Exercises
6: Function objects
Command: choosing the operation at run-time
Strategy: choosing the algorithm at run-time
Chain of responsibility
Exercises
7: Changing the interface
Adapter
Façade
Exercises
8: Table-driven code: configuration flexibility
Table-driven code using anonymous inner classes
10: Callbacks
Observer
Observing flowers
A visual example of observers
Exercises
11: Multiple dispatching
Visitor, a type of multiple dispatching
Exercises
12: Pattern refactoring
Simulating the trash recycler
Improving the design
Make more objects
A pattern for prototyping creation
Trash subclasses
Parsing Trash from an external file
Recycling with prototyping
Abstracting usage
Multiple dispatching
Implementing the double dispatch
The Visitor pattern
A Reflective Decorator
More coupling?
RTTI considered harmful?
Summary
Exercises
13: Projects
Rats & Mazes
Other maze resources
XML Decorator