Behavioral Design Pattern in C#

Behavioral Design Pattern in C#

In this article, I am going to give a brief introduction to Behavioral Design Pattern in C#. Please read our previous article where we discussed the Structural Design Patterns in C# with examples. As part of this article, we are going to discuss the following three things.

  1. What is Behavioral Design Pattern?
  2. When to use the Behavioral Design Pattern?
  3. Examples of Behavioral Design Pattern
What is Behavioral Design Pattern in C#?

According to Wikipedia, in Software Engineering, behavioral design patterns are design patterns that identify common communication patterns among objects and realize these patterns. By doing so, these patterns increase flexibility in carrying out this communication.

Behavioral patterns are those patterns that are concerned with the interaction between the objects. The interaction between the objects should be in such a way that they are talking to each other and still are loosely coupled. The loose coupling is the key to n-tier architecture.

A behavioral pattern explains how objects interact. It describes how different objects and classes send messages to each other to make things happen and how the steps of a task are divided among different objects.

When to use Behavioral Design Patterns in C#?

In real-time applications, sometimes we want to change the behavior of a class and again we don’t want it to affect other classes of the project. For example, we have an Invoice class which currently applying taxes as 18%. Tomorrow if we want to add another extra tax. That means we are changing the behavior of a class. To solve such type of Behavioral issues Behavioral Design Pattern comes into the picture.

Examples of Behavioral Design Pattern in C#:
  1. Iterator Design Pattern
  2. Observer Design Pattern
  3. Chain of Responsibility Design Pattern
  4. Interpreter Design Pattern
  5. Command Design Pattern
  6. Memento Design Pattern
  7. Mediator Design Pattern
  8. State Design Pattern
  9. Template Method Design Pattern
  10. State Design Pattern
  11. Strategy Design Pattern
  12. Visitor Design Pattern
  13. Null Object Pattern

In the next article, I am going to discuss the Iterator Design Pattern in C# with some examples. Here, in this article, I try to give a brief introduction to Behavioral Design Pattern. I hope you understood the need and use of the Behavioral Design Pattern in C#.

Leave a Reply

Your email address will not be published. Required fields are marked *