Behavioral Design Patterns

Behavioral patterns are specifically concerned with identifying common interactions between objects and realizing these. This increases the flexibility by letting them talk to each other but still retaining the desired loose coupling between these objects. Some of these patterns overlap with patterns from the Structural Patterns section.

 

Behavioral class patterns use inheritance to distribute behavior between classes. [GoF, "Design Patterns", Addison Wesley, ISBN 0201633612].

 

Behavioral object patterns use object composition rather than inheritance. [GoF, "Design Patterns", Addison Wesley, ISBN 0201633612].

  • Iterator encapsulates the way you access and traverse the elements of an aggregate sequentially without exposing its underlying representation.
  • Observer defines a one-to-many dependency between objects, distributes communication. Observer notifies all its dependents when the observed object changes its state.
  • Event Listener is a special flavor of the Observer pattern.
  • Strategy encapsulates algorithms (separately) and makes them interchangeable. Strategy lets the algorithm vary depending on the client that uses it.

 

References / More Info

Behavioral Patterns - Wikipedia