One of the most asked questions in the interviews for new possitions regarding C++ are the Design patterns. It’s a topic that I’ve used a lot but I don´t have in my mind a good idea about it. Until today. This is the solution for that.
Kinds of design patterns
First of all we need to know that there are three kinds of design patterns depending on the matter you are focused on. The existing ones are:
- Creational patterns
- Structural patterns
- Behavior patterns
A good place to have more info is Refactoring guru but I will dive a little bit more on this different types of patterns.
Creational patterns
This ones are focused on how to create objects. The most common ones are:
- Abstract Factory
- Builder
- Factory Method
- Prototype
- Singleton
Structural patterns
This ones are regarding the data structure of the objects
- Adapter
- Bridge
- Composite
- Decorator
- Facade
- Flyweight
- Proxy
Behavior patterns
This ones are focused on the things that the objects can do during its life cycle:
- Chain of Responsibility
- Command
- Iterator
- Mediator
- Memento
- Observer
- State
- Strategy
- Template Method
- Visitor
As you can see, there are a lot of them. Read the details of them here