What are Design Patterns?
A: Development patterns that aims to solve a specific problem in the development and maintenance of software.
Using the example of the DAO pattern, which is a pattern where the access code to the data (typically CRUD) is centered on it. This pattern solves a problem of organization and responsibilities, and also for that, it is a structural pattern.
GoF (Gang Of Four) Patterns are the patterns defined in the book Design Patterns: Elements of Reusable Object-Oriented Software and are classified into three categories: creational, structural and behavioral.
Types Of Design Patterns
- Creational Patterns
Are the patterns that involve the centralization and / or control of the objects to be created.
Most known/used: Factory, Singleton, Builder, etc.
- Structural Patterns
Are patterns that involve a little bit more of the architecture of the code, structure and mode of data access.
Most known/used: DAO¹, Adapter, Facade, Composite, Decorator, etc.
¹ – Although not be found in one of three patterns, DAO (Data Object Access) can be considered a structural pattern.
- Behavioral Patterns
Are the patterns that focus on the assignment of responsibilities between the objects and the way of communication between them.
Most known/used: Strategy, Observer, Iterator, Template Method, etc.
My Favorite Design Patterns
Creational: AbstractFactory, Factory Method
Structural: DAO, Facade, Service
Behavioral: Strategy, Template Method
- Developers around the world have had many problems and the solutions that arrived we call Design Patterns. So if you have a specific problem, there is a possibility of a Design Pattern to help you.
- Some patterns avoid problems with future maintenance and directly influence the code architecture, then, if necessary, can be used design patterns for architecture .
Design Pattern is a universal language among programmers, so instead of spending time trying to invent a solution to your problem and there is a design pattern that already solves and efficiently, it is recommended to use the Design Pattern. The developer will look and will soon understand the pattern and must know what kind of problem you solved using the chosen pattern.
Well, that’s it, folks. Already knew the Design Patterns? Do you use? If so, tell me what you use and what you most prefer and / or why prefer. I hope you enjoyed.