Behavioral Design Patterns
  • are concerned with algorithms and the assignment of responsibilities between objects

Behavioral Design Patterns

Chain of Responsibility (CoR) Pattern

  • avoid coupling the sender of a request to its receiver by giving multiple objects a chance to handle the request, chaining the receivers and passing the request along the chain until one handles it

Command Pattern

  • encapsulate a request as an object, thereby allowing you to parameterize clients with queues, requests, or operations, and support undoable operations

Feature Toggle Pattern

  • enable or disable features at runtime without deploying new code, allowing dynamic control over functionality for testing, gradual rollouts, or experimentation

Iterator Pattern

  • provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation

Mediator Pattern

  • defines an object that encapsulates how a set of objects interact, promoting loose coupling by preventing objects from referring to each other explicitly

Memento Pattern

  • capture and externalize an object’s internal state so it can be restored later, without violating encapsulation

Null Object Design Pattern

  • provides an object with a neutral (“do nothing”) behavior as a surrogate for null, so clients can safely call methods without null checks

Observer Pattern (Publisher-Subscriber Pattern)

  • defines a one-to-many dependency between objects so that when one object (the subject) changes state, all its dependents (observers) are notified and updated automatically

State Pattern

  • allow an object to alter its behavior when its internal state changes, making it appear as if the object changed its class

Strategy Pattern

  • defines a family of algorithms that “solve” the same thing, put each of them into a separate class, and make their objects interchangeable

Template Method Pattern

  • defines an overall fixed algorithm in a base class, deferring some steps to subclasses, so subclasses can redefine parts of the algorithm without changing its overall structure

Visitor Pattern

  • represent an operation to be performed on elements of an object structure, letting you define new operations without changing the classes of the elements

Acyclic Visitor Pattern

  • allow adding new operations to a set of classes without creating cyclic dependencies between the visitor and elements, enabling flexible extension of visitor behavior for only the elements you care about