date: 2020-08-25 21:43:00
title: A Design Patterns summary
description: Design Patterns summary from the gang of four Desing Pattern book.
author: osmarpetry
image: /assets/img/design-pattern.png
In the place I work, I was developing new skills. One of these skills is about Design Patterns.
After creating this goal for me, was decided to make a presentation about some Design Patterns for my POD in Brazil and to the subsidiary on my city Joinville. But in the end, I created a presentation about all Design Patterns in the book of the gang of four.
In this publication, I will write what I used to help me in the presentation, will not be code. For that, I think is better you go to https://refactoring.guru/, where you can have a unique example of the pattern in your favorite language.
### First things firsts
The idea you know differents design patterns, in my opinion, is to you have a commonplace for everyone to write in the same pattern between different projects. Will be easier in the future to other new developers in the project to fully understand the code pattern that your team is using. I don't mean those patterns are the best, maybe a unique design pattern to your project would be better, but your team should have good documentation with example and covering corner cases in your unique design pattern.
### Different purposes and scopes of design patterns
In the following image that you can have from the book or the gang of for, you can see three purposes device by two scopes (class and object).

The difference between the scope class and object will be visible on the factory pattern. Where Factory Pattern you just create one custom function in the class (class scope) and in the Abstract Factory, you create a fully custom object (object scope).
The porpuses difference is the pattern will change the way your code is created, is structured or behave. You can check better the difference between structural and behavioral with Decorator and Chain of Responsibility. Where on Decorator one Decorator doesn't depend on the other Decorator not chacing the behave of your code, but on Chain Responsibility, if some chain is braked the rest your code will not be executed, changing the behavior* of your code.
I tried to a little deep over every pattern, but this will take too much time and will not be so complete as the https://rafatiring.guru.com already has, with images, diagrams, and code examples in different languages.
## My apresentation about this subject