Design patterns were introduced by GOF(Gangs Of Four) Erich Gamma, Richard Helm, Ralph Johnson,
and John Vlissides’s seminal work Design Patterns: Elements of Reusable Object-Oriented Software (Addison-Wesley).
Design patterns provide a high-level language of discourse for programmers to describe their systems and to discuss solutions to common problems. This language comprises the names of recognizable patterns and their elements. Each design pattern shave its own templates and these patterns have illustrative names and are described with diagrams illustrating, their role players. There are 23 design patterns. These patterns are divided into three groups: structural, creational, and behavioral.
Creational Design Patterns
The creational patterns aim to separate a system from how its objects are created, composed, and represented. They increase the system’s flexibility in terms of the what, who, how, and when of object creation. Creational patterns encapsulate the knowledge about which classes a system uses, but they hide the details of how the instances of these classes are created and put together. Following are the design patterns are falls in to this category.
Prototype Pattern: It creates objects by cloning an existing object.
Factory Methods Design Pattern: It creates objects without specifying the exact class to create.
Singleton Design Pattern: It restricts object creation for a class to only one instance.
Abstract Factory Design Pattern: It groups object factories that have a common theme.
Builder Design Pattern: It constructs complex objects by separating construction and representation.
Behavioral patterns are concerned with algorithms and communication between them. The operations that make up a single algorithm might be split up between different classes, making a complex arrangement that is difficult to manage and maintain. The behavioral patterns capture ways of expressing the division of operations between classes and optimize how the communication should be handled. Following are the patterns falls in to this category.
Strategy Design Pattern: allows one of a family of algorithms to be selected on-the-fly at runtime.
State Design Pattern: allows an object to alter its behavior when it’s internal state changes.
Template Methods Design Pattern: defines the skeleton of an algorithm as an abstract class, allowing its subclasses to provide concrete behavior.
Command Design Pattern: creates objects which encapsulate actions and parameters.
Chain of Responsibility Design Pattern: delegates commands to a chain of processing objects.
Iterator pattern Design Pattern: accesses the elements of an object sequentially without exposing its underlying representation.
Mediator Design Pattern: allows loose coupling between classes by being the only class that has detailed knowledge of their methods.
Observer Design Pattern: is a publish/subscribe pattern which allows a number of observer objects to see an event.
Visitor Design Pattern: separates an algorithm from an object structure by moving the hierarchy of methods into one object.
Interpreter Design Pattern: implements a specialized language.
Memento Design Pattern: provides the ability to restore an object to its previous state (undo).
In this article we are learn about software design patterns, All these design patterns are described in details with examples. I hope you will find it useful these article.