Behavioral patterns se zabývají tím, jak objekty interagují a komunikují — přiřazením odpovědností a tokem komunikace mezi objekty. Zahrnují Observer, Strategy, Command, Iterator, State, Template Method a další.
Co behavioral patterns řeší
BEHAVIORAL patterns concern how objects INTERACT, communicate, and distribute
responsibilities:
→ how objects collaborate and assign responsibilities to achieve behavior
→ manage algorithms, communication, and control flow between objects
→ about BEHAVIOR and interaction, not creation or structure
Hlavní behavioral patterns
OBSERVER → notify many objects of state changes (covered separately) — very common
STRATEGY → interchangeable algorithms, swappable at runtime (covered separately) — common
COMMAND → encapsulate a request as an object (queue, log, undo operations)
ITERATOR → traverse a collection without exposing its internal structure
STATE → change behavior based on internal state (an object behaving like different "states")
TEMPLATE METHOD → define an algorithm's skeleton, let subclasses fill in steps
CHAIN OF RESPONSIBILITY → pass a request along a chain of handlers until one handles it
MEDIATOR → centralize complex communication between objects (reduce direct coupling)
