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 how to solve a problem that can be used in many different situations. So patterns are formalized best practices that you must implement yourself in your application.
Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such.
Design patterns reside in the domain of modules and interconnections. At a higher level there are architectural patterns that are larger in scope, usually describing an overall pattern followed by an entire system.
Design patterns solve the problem is tight coupling and encourage loose coupling
Below given are some design patterns
- The factory pattern – Create object with out ‘new’
- The singleton pattern – Allows only one object at a time
- The observer pattern
- The chain-of-command pattern
- The strategy pattern
- Decorator Pattern
- Service Locator – Allows overrides or renamed physical resources
- Prototype – Create object with the help of another object