What are software design patterns?

Design patterns were formally introduced in the book Design Patterns: Elements of Reusable Object-Oriented Software, first published in 1994 by the four authors Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, with a foreword by Grady Booch. These authors are usually referred to as the Gang of Four. The book contains the most popular 23 design patterns; hence, the 23 patterns are known as GoF design patterns. These design patterns are fundamentally the crux of object-oriented analysis and design (OOAD).

Here, we will cover some of the most commonly used GoF design patterns and look at their implementation in C# using the latest version of .NET Core.

23 GoF design patterns are divided into three main categories. I will write the names and a one-liner explanation about them and after that, I will go into detail about the selected ones:

We just gave an almost single line definition for all 23 GoF design patterns. Some of them would be obvious to understand, while others might be difficult, if not confusing. So when we get into the details of certain patterns, their intent, design, and reference implementation should be clearer.

We have already covered the decorator pattern as an example of SRP earlier. In the remainder of the chapter, we will cover the following design patterns:

Four creational design patterns are as follows:

  • Singleton
  • Factory method
  • Abstract factory
  • Builder

Three structural design patterns are as follows:

  • Adapter
  • Bridge
  • Flyweight

Six behavioral design patterns are as follows:

  • The template method
  • Observer
  • Chain of responsibility
  • Visitor
  • Strategy
  • State
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.168.214