In this lesson we will discuss what the design patterns, the types of design patterns are and in the next lesson I will talk about the first (Anti) pattern, singleton, personally, in most cases I do not recommend using it. Why not? We’ll get to that 🙂
What are design patterns?
There are many repetitive problems in the design of various information systems, these are usually repetitive problems, and design patterns have been created for these repetitive problems.
Due to the fact that specific design patterns have been created for specific problems, if we use a design pattern in the wrong way, it may end in a tragedy for us, it must be remembered that a design patern aren’t a problem, problem is wrong using and incomprehension.
Therefore, when in the introduction I said that Singleton is not recommended for use in most cases, among others because it breaks the principles of SOLID, Single responsibility (SRP) and Open-closed (OCP) and is stiff, not flexible and makes testing is difficult, but in some cases is a useful pattern. In the next lesson, I will describe Singleton in more detail.
Types of design patterns
1. Creational design patterns
They allow to separate the process of creating object instances from their definitions:
2. Structural design patterns
Patterns regarding problems with relations between many classes, solve typical problems of systems that have many classes, for example, so that binding beetwen class are not too strong or not to use too much CPU resources:
3. Behavioral design patterns
They are responsible for sharing responsibility between classes, if someone knows the principles of Solid, in particular the first one will understand what’s going on.
- Chain of responsibility
- Template Method
And that would be enough of these more important design patterns, I will try to describe them all, there are also architectonic patterns such as MVC or MVVM, and design patterns for concurrent applications. I will try to describe them all in the next lessons on practical examples.
This content also you can find on my steemit blog https://steemit.com/patterns/@slawas/introduction-to-design-patterns
And that’s it when it comes to theories about design patterns, in the next lesson we will discuss Singleton.