Skip to content

Most popular design patterns in C# (.NET). OOP, SOLID, Builder, Factory, Abstract Factory, Prototype, Singleton, Strategy, Observer

Notifications You must be signed in to change notification settings

bartoszclapinski/DesignPatterns.NET

Repository files navigation

Most popular design patterns in C# (.NET)

This repository contains the most popular design patterns in C# (.NET) with examples.

What is a design pattern?

A design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.

OOP

Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data, in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods).

  1. Abstraction
  2. Classes
  3. Encapsulation
  4. Inheritance
  5. Interfaces
  6. Polymorphism

SOLID Principles

SOLID is an acronym for the first five object-oriented design (OOD) principles by Robert C. Martin. These principles intend to make software designs more understandable, flexible, and maintainable.

  1. Single Responsibility Principle (SRP)
  2. Open/Closed Principle (OCP)
  3. Liskov Substitution Principle (LSP)
  4. Interface Segregation Principle (ISP)
  5. Dependency Inversion Principle (DIP)

Creational Design Patterns

Creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation.

  1. Singleton
  2. Factory Method
  3. Abstract Factory
  4. Builder
  5. Prototype

Structural Design Patterns

Structural design patterns are design patterns that ease the design by identifying a simple way to realize relationships between entities.

  1. Adapter
  2. Facade
  3. Decorator
  4. Proxy

Behavioral Design Patterns

Behavioral design patterns are design patterns that identify common communication patterns between objects and realize these patterns.

  1. Observer
  2. Strategy
  3. Chain of Responsibility
  4. State
  5. Mediator
  6. Template Method