Home Design Patterns using C# 10
Post
Cancel

Design Patterns using C# 10

Table of Contents

Design patterns

We will be covering the design patterns set forth by the Gang of Four (GoF). There are around 23 patterns divided in to 3 categories, namely

  • Creational
  • Structural
  • Behavioral

In this post, we will look at each of these patterns to understand what they are, when to use them, pros and cons along with real coding examples using C#10.

Creational patterns

These patterns help make the system independent of how its objects are being created, composed or structured. The following are the 5 creational patterns

  • Singleton
  • Factory
  • Abstract Factory
  • Builder
  • Prototype

Structural patterns

These patterns concerns with how classes and objects are composed to form large complex structures. Think about inheritance and composition. There are 7 structural patterns

  • Adapter
  • Composite
  • Proxy
  • Flyweight
  • Facade
  • Bridge
  • Decorator

Behavioral patterns

These patterns deal with the control-flow of the project which could be hard to navigate during the runtime. These patterns helps us focus on the way objects are interconnected. Think about loose coupling, extensibility etc. There are 11 behavioral patterns in total.

  • Template method
  • Mediator
  • Chain of responsibility
  • Observer
  • Strategy
  • Command
  • State
  • Visitor
  • Interpretor
  • Iterator
  • Memento
This post is licensed under CC BY 4.0 by the author.