Design Patterns is a set of best design practices that are used to address many recurring problems in object-oriented programming.
The concept of Design Patterns was the result of work done by a group of 4 people (Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, known as "the Gang of Four") published in 1995 in a book titled "Design Patterns: Elements of Reusable Object-Oriented Software" in which they outlined 23 design patterns.
A design pattern can be regarded as a document which defines a class structure which addresses a particular situation. Design patterns are divided into three major groups:
- Creation Patterns: Abstract Factory Pattern, Builder Pattern, Factory Method Pattern, Prototype Pattern, Singleton Pattern.
- Structural Patterns: Adapter Pattern, Bridge Pattern, Composite Pattern, Decorator Pattern, Facade Pattern, Flyweight Pattern, Proxy Pattern.
- Behavior Patterns: Chain of Responsibility Pattern, Command Pattern, Interpreter Pattern, Iterater Pattern, Mediator Pattern, Memento Pattern, Observer Pattern, State Pattern, Strategy Pattern, Template Method Pattern, Visitor Pattern.
The following are examples of design patterns:
- MVC (Model-View-Controller) Pattern: comes from the principle that all applications can be broken down into three separate layers:
- Model: the data used in the application
- View: how the data is represented to the user
- Controller: the way data is processed in the user interface
- Proxy Pattern which defines an intermediary object which calls on a remote object and which is transparent to the user.
Patrones de diseño