Design patterns represent the best practices used by experienced software developers and designers. These design patterns provide common solutions to common problems that all developers will face at one time or another during software development. The patterns that are articulated in each of these solutions were obtained thru extensive trial and error scenarios by software developers over quite a substantial period of time. They have been refined over time to provide a practical guide in the resolution of common issues.
History of Design Patterns
In 1994, four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides published an watershed book titled Design Patterns - Elements of Reusable Object-Oriented Software. This book would initiated the theory of Design Pattern in software development.
Together these authors are collectively known as Gang of Four (GOF). The design pattern principles they pioneered commonly known as GOF Patterns. According to these authors, software design patterns are primarily based on the following principles of object orientated design; program to an interface not an implementation and favoring of object composition over inheritance.
Design Pattern Usage
Design Patterns have two main predominant usages within software development:
Common platform for developers
Use of design patterns provide a standardized terminology and are specifically linked to a particular scenario. As an example, the Singleton design pattern signifies use of single object. So, all developers familiar with this single design pattern principle will make use of single object. Thus, they can tell each other that their application is following a singleton pattern.
Best Practices
Design patterns have been evolved over a long period of time and they provide best solutions to certain problems faced during software development. Learning these patterns helps unexperienced developers to learn software design in an easy and faster way.
Types of Design Patterns
From a software development perspective there are 23 design patterns which can be classified in three categories: Creational, Structural and Behavioral patterns.
Creational Patterns
These The design patterns within this category will provide a way method to create objects while hiding the creation logic, rather than instantiating objects directly using new operator. This gives The utilization of these patterns will allow program more flexibility in deciding determining which objects need to should be created for a given use case.
Structural Patterns
The design patterns within this category concern class and object composition. The principle of inheritance is used to comprise and compose interfaces and define ways to construct objects to obtain new functionalities.
Behavioral Patterns
The design patterns within this category are specifically concerned with object-level communication.