Design Patterns – Behavioral Patterns

The behavioral patterns are about identifying the common communication patterns between objects and bring about these patterns. The behavioral patterns have more ways to implement, such as Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Null Object, Observer, State, Strategy, Template method, and Visitor.

From Design Pattern – Introduction

Behavioral patterns focus on the object communication between objects. Sometimes, it is concerned with algorithms and responsibilities between objects and brings with the business logic concepts.

  • Chain of Responsibility – It lets the program passes the client requests along a chain of handlers. Upon receiving the client’s requests, each handler will decide to process the client’s requests or give them to the next handler in the chains.
  • Command – It turns the client’s requests into a stand-alone object which contains all information about the client’s requests. These transformations let the programs pass the client requests to method arguments, delay or queue the client’s execution, and undoable operations.
  • Interpreter –  It provides to evaluate the language grammar and description. This idea bases on having the class for each symbol in a specialized computer language.
  • Iterator – It let the programs traverse all of the collection elements without their underlying representation and can non-know the set objects base layer to describe it.
  • Mediator – It can let the program reduces chaotic dependencies between objects. This pattern can restrict the direct communications between the object and forces them to collaborates with a mediator object.
  • Memento – It allows the programs to save and restore the object’s previous state without revealing its implementation details.
  • Null Object – Designed to act as a default value of an object
  • Observer – It lets the programs define a subscription mechanism to notify multiple objects, which means when the events happen, other objects can observe and immediately respond or modify object property.
  • State – This pattern can let the program’s object alter its behavior when its internal state changes, which seems like it changes its class.
  • Strategy – It allows the programs to define a family of an algorithm, put each one into a separate class, and make their objects interchangeable.
  • Template method – It means the program defines an algorithm skeleton in the superclass, which lets subclasses override algorithm-specific steps that are without changing their structure.
  • Visitor – It allows the program changes the algorithm and the operations that base on the visitor to change, which means can separate the algorithms from objects on which they operate.

Reference

11 Comments

Leave a Reply