A design pattern is a general reusable solution to a commonly occurring problem in software design. Use this tag for questions when you're having problems with the implementation of design-patterns. Please don't use this tag on questions about text pattern matching. When using this tag on implementation heavy questions - tag the code language the implementation is written in.
In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design.
A design pattern is not a finished design that can be transformed directly into code. It is a description or template for solving a problem that can be used in many different situations.
Object-oriented design patterns typically show relationships and interactions between classes or objects without specifying the final application classes or objects involved. Many patterns imply object-orientation or a more generally mutable state, which may not be as applicable in functional programming languages, in which data is immutable or treated.
Design patterns are generally described using the Unified Markup Language ([tag: UML]) - a class diagram shows the relationship between the design pattern components. In addition, UML has a sufficiently extensive and expressive vocabulary that helps describe the details of patterns.
The seminal book that introduced the concept had four authors, often referred to as the "Gang of Four".
Gang of Four design patterns
Creational patterns: abstract-factory builder factory-method prototype-pattern singleton
Structural patterns: adapter bridge composite decorator facade flyweight-pattern proxy-pattern
Behavioral patterns: chain-of-responsibility command-patterninterpreter-pattern iterator mediator memento observer-pattern state-pattern strategy-pattern template-method-pattern visitor
Concurrency patterns
Other patterns
- dependency-injection
- front-controller
- lazy-initialization
- module
- model-view-controller
- multiton
- null-object-pattern
- parameter-object
- unit-of-work