- 2023-05-18 - Added the
Behavioral
folder with theChain of Responsibility
pattern. Pending: add all UML diagrams and README for explain the samples.
This repository contains samples of design patterns in C#. Use for learning purposes.
A design pattern is a general, reusable solution to a commonly occurring problem within a given context in software design.
It is a description or template for how to solve a problem that can be used in many different situations.
By using a pattern, you can avoid reinventing the wheel every time you run into a common problem and communication better the solution with your team.
There are three types of design patterns:
- Creational patterns: these patterns are all about class instantiation.
- Structural patterns: these patterns are about organizing different classes and objects to form larger structures and provide new functionality.
- Behavioral patterns: these patterns are all about class's objects communication. Behavioral patterns are those patterns that are most specifically concerned with communication between objects.
Each pattern is in a separate folder. The folder contains a README.md
file with a description of the pattern and a sample of the pattern in C#.
- The creational patterns are in the
Creational
folder. - The structural patterns are in the
Structural
folder. - The behavioral patterns are in the
Behavioral
folder.
Open the solution in Visual Studio 2022 and run the specific project that you want understand.
All concepts about desing pattern is about the main techniques and principles of object-oriented design. If you want to learn design patterns, you need to know the following concepts:
- Abstraction: the process of hiding the internal details and showing only the functionality.
- Encapsulation: the process of binding together the data and the functions that manipulate them.
- Inheritance: the process of creating new classes from existing classes.
- Polymorphism: the ability of an object to take on many forms.
SOLID principles are also important to learn design patterns, because some patterns are based on these principles.
By https://www.fabiodeveloper.com - Every person is unique! Enjoy it :-) - MIT license - 2023