Categories: Design Pattern

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

davidsky69

View Comments

Recent Posts

API Gateway in .NET 5 with Ocelot

What is the API gateway? An API gateway is an API management tool that sits…

3 years ago

.NET 5 application with Onion architecture

The .NET 5 SDK is a kind of milestone in the .NET world. The .NET…

3 years ago

SOLID Principles – Dependency inversion principle

In object-oriented design, the dependency inversion principle is a specific methodology for loosely coupling software…

4 years ago

SOLID Principles – Interface segregation principle

In the field of software engineering, the interface segregation principle (ISP) states that no code…

4 years ago

SOLID Principles – Liskov substitution principle

Subtype Requirement: Let  be a property provable about objects  of type T. Then  should be true for objects  of type S where S is…

4 years ago

SOLID Principles – Open-closed principle

In object-oriented programming, the open–closed principle states "software entities (classes, modules, functions, etc.) should be…

4 years ago