--Originally published at Hackerman's house
Design patterns in programming are like recipes in cooking. They are not the final product, but instructions to obtain your final product in an easier and adequate way. Design patterns are repeatable solutions to common problems that occur in software design. They provide proven development paradigms that can help you prevent issues while developing. One of the advantages of design patterns is that they are so common that they are improved over time, making them more robust and more useful overall.
Design patterns are divided into 3 categories, creational patterns, structural patterns and behavioral patterns.
Creational Design Patterns
These design patterns are about class instantiation.
Abstract factory creates an instance of several families of classes. It provides an interface for creating families of related objects without specifying their concrete class.
Builder separates object construction from its representation. This can be used in a way that the same construction processes can create different representations.
Factory Method creates an instance of several derived classes. It is basically an interface that the subclasses adapt to do their own specific tasks.
Prototype is a fully initialized instance that can be copied or cloned. It is used when direct creation of an object is costly, creates new objects by copying this prototypical instance.
Singleton is a class of which only a single instance can exist.
Structural Design Patterns
These design patterns are about Class and object composition. These patterns are divided into class creation patterns that use inheritance to compose interfaces, object patterns define ways to compose objects to obtain new functionality.
Adapter converts the interface of a class into another interface. This allows a class to work with another one even if it had an incompatible interface.
Bridge separates an object’s interface from its implementation.
Composite; composes object intro tree structures to represent hierarchies.
![Resultado de imagen para behavior](https://i2.wp.com/www.businessnewsdaily.com/images/i/000/004/285/i02/behavior.jpg)
Façade is a class that represents an entire subsystem.
Flyweight uses the shared characteristics of a large number of objects, ignoring the other characteristics of the objects that don’t have importance to the developer.
Proxy is a placeholder for another object, this can be used to control the references to it.
Behavioral Patterns
These design patterns are about communication between objects.
Chain of responsibility.
Command.
Interpreter.
Iterator.
Mediator.
Memento, captures the internal state of an object without violating encapsulation.
Null object.
Observer.
State.
Strategy.
Template method.
Visitor.
Reference: