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.

This design pattern is all about class and object composition. Structural class creation patterns use inheritance to compose interfaces. The structural object patterns define ways to compose objects to obtain new functionality.

The structural patterns describe how objects and classes can be combined to form larger structures.

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#:
  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 some examples. Here, in this article, I try to give a brief introduction to Structural Design Pattern. 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. Required fields are marked *