In software engineering, a software design pattern is a general, reusable solution to a commonly occurring problem within a given context in software design. It is not a finished design that can be transformed directly into code. Instead, it is a description or template for solving a problem that can be used in many different situations. Design patterns are formalised best practices that the programmer can use to solve common problems when designing an application or system.
Design patterns have evolved, and they provide the best solutions to particular problems faced during software development. Learning these patterns helps inexperienced developers to learn software design in an easy and faster way.
In 1994, four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, published a book titled Design Patterns: Elements of Reusable Object-Oriented Software which initiated the concept of Design Pattern in Software development. The book is divided into two parts, with the first two chapters exploring the capabilities and pitfalls of object-oriented programming and the remaining chapters describing 23 classic software design patterns.
The book has been influential to software engineering and is an essential source for object-oriented design theory and practice. More than 500,000 copies have been sold in English and 13 other languages.
The authors are often referred to as the Gang of Four (GoF).
Design patterns can be classified into three categories:
Creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation.
Structural design patterns ease the design by identifying a simple way to realise formalised relationships among entities.
Behavioural design patterns are design patterns that identify common communication patterns among objects. By doing so, these patterns increase flexibility in carrying out communication.