Structural Design Pattern in C#

Structural Design Patterns in C#

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

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

According to Wikipedia, in software engineering, Structural Design Patterns are design patterns that ease the design by identifying a simple way to realize the relationship among entities. In simple words, we can say that the Structural Design Pattern is basically used to manage the structure of classes and interface as well as manage the relationship between the classes. 

When to use Structural Design Patterns in C#?

In real-time applications, sometimes we need to change the structure of a class or the relationship among the classes but we don’t want this change to be affected by the project. For example, if we have two classes let say User and Product. And the Product class is used inside the User class making one-to-many relationships between the User and Product. Tomorrow, the structure or the relationships between these two classes change. The customer now wants to keep away the Product class from the User class, as they want to use the User and Product class independently. This is actually a structural change and we don’t want this structural change to affect our project. This is where the Structural Design Pattern helps us.

Examples of Structural Design Patterns in C#:

The following is the list of Structural Design Patterns.

  1. Adapter Design Pattern
  2. Facade Design Pattern
  3. Decorator Design Pattern
  4. Bridge Design Pattern
  5. Composite Design Pattern
  6. Proxy Design Pattern
  7. Flyweight Design Pattern

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

Leave a Reply

Your email address will not be published.