How objects interact.
WHAT PROBLEM THEY ADDRESS
Distributing responsibility and communication between objects.
WHAT THE STRATEGY PATTERN DOES
Makes an algorithm interchangeable.
When it helps: several ways of doing something, selected at runtime.
Why it matters: it replaces long conditional chains selecting behaviour.
WHAT THE OBSERVER PATTERN DOES
Notifies interested parties when something changes.
When it helps: several things must react to an event, and the source should not know about them.
WHAT THE COMMAND PATTERN DOES
Represents an action as an object.
When it helps: queuing, undoing or logging actions.
WHAT THE TEMPLATE METHOD DOES
Defines a sequence, with specific steps supplied by subtypes.
WHAT THE STATE PATTERN DOES
Changes behaviour based on internal state, without conditional chains.
When it helps: objects with distinct states and transitions.
WHAT THE REPOSITORY PATTERN DOES
Provides a collection-like interface to stored data, hiding the storage.
Why it matters: business logic does not depend on the database.
WHAT TO NOTICE
Several of these replace conditional chains with polymorphism.