Difference between revisions of "Design Patterns"

Line 9: Line 9:
 
===Creational patterns===
 
===Creational patterns===
 
These design patterns are all about class instantiation. This pattern can be further divided into class-creation patterns and object-creational patterns. While class-creation patterns use inheritance effectively in the instantiation process, object-creation patterns use delegation effectively to get the job done.
 
These design patterns are all about class instantiation. This pattern can be further divided into class-creation patterns and object-creational patterns. While class-creation patterns use inheritance effectively in the instantiation process, object-creation patterns use delegation effectively to get the job done.
====[[Abstract Factory Design Pattern]]===
+
====[[Abstract Factory Design Pattern]]====
 
Creates an instance of several families of classes
 
Creates an instance of several families of classes
====[[Builder Design Pattern]]===
+
====[[Builder Design Pattern]]====
 
Separates object construction from its representation
 
Separates object construction from its representation
====[[Factory Method Design Pattern]]===
+
====[[Factory Method Design Pattern]]====
 
Creates an instance of several derived classes
 
Creates an instance of several derived classes
====[[Object Pool Design Pattern]]===
+
====[[Object Pool Design Pattern]]====
 
Avoid expensive acquisition and release of resources by recycling objects that are no longer in use
 
Avoid expensive acquisition and release of resources by recycling objects that are no longer in use
====[[Prototype Design Pattern]]===
+
====[[Prototype Design Pattern]]====
 
A fully initialized instance to be copied or cloned
 
A fully initialized instance to be copied or cloned
====[[Singleton Design Pattern]]===
+
====[[Singleton Design Pattern]]====
 
A class of which only a single instance can exist
 
A class of which only a single instance can exist
 +
 
===Structural patterns===
 
===Structural patterns===
 
These design patterns are all about Class and Object composition. Structural class-creation patterns use inheritance to compose interfaces. Structural object-patterns define ways to compose objects to obtain new functionality.
 
These design patterns are all about Class and Object composition. Structural class-creation patterns use inheritance to compose interfaces. Structural object-patterns define ways to compose objects to obtain new functionality.
====[[Adapter Design Pattern]]===
+
====[[Adapter Design Pattern]]====
 
Match interfaces of different classes
 
Match interfaces of different classes
====[[Bridge Design Pattern]]===
+
====[[Bridge Design Pattern]]====
 
Separates an object’s interface from its implementation
 
Separates an object’s interface from its implementation
====[[Composite Design Pattern]]===
+
====[[Composite Design Pattern]]====
 
A tree structure of simple and composite objects
 
A tree structure of simple and composite objects
====[[Decorator Design Pattern]]===
+
====[[Decorator Design Pattern]]====
 
Add responsibilities to objects dynamically
 
Add responsibilities to objects dynamically
====[[Facade Design Pattern]]===
+
====[[Facade Design Pattern]]====
 
A single class that represents an entire subsystem
 
A single class that represents an entire subsystem
====[[Flyweight Design Pattern]]===
+
====[[Flyweight Design Pattern]]====
 
A fine-grained instance used for efficient sharing
 
A fine-grained instance used for efficient sharing
====[[Private Class Data Design Pattern]]===
+
====[[Private Class Data Design Pattern]]====
 
Restricts accessor/mutator access
 
Restricts accessor/mutator access
====[[Proxy Design Pattern]]===
+
====[[Proxy Design Pattern]]====
 
An object representing another object
 
An object representing another object
 +
 
===Behavioral patterns===
 
===Behavioral patterns===
 
These design patterns are all about Class's objects communication. Behavioral patterns are those patterns that are most specifically concerned with communication between objects.
 
These design patterns are all about Class's objects communication. Behavioral patterns are those patterns that are most specifically concerned with communication between objects.
====[[Chain of Responsibility Design Pattern]]===
+
====[[Chain of Responsibility Design Pattern]]====
 
A way of passing a request between a chain of objects
 
A way of passing a request between a chain of objects
====[[Command Design Pattern]]===
+
====[[Command Design Pattern]]====
 
Encapsulate a command request as an object
 
Encapsulate a command request as an object
====[[Interpreter Design Pattern]]===
+
====[[Interpreter Design Pattern]]====
 
A way to include language elements in a program
 
A way to include language elements in a program
====[[Iterator Design Pattern]]===
+
====[[Iterator Design Pattern]]====
 
Sequentially access the elements of a collection
 
Sequentially access the elements of a collection
====[[Mediator Design Pattern]]===
+
====[[Mediator Design Pattern]]====
 
Defines simplified communication between classes
 
Defines simplified communication between classes
====[[Memento Design Pattern]]===
+
====[[Memento Design Pattern]]====
 
Capture and restore an object's internal state
 
Capture and restore an object's internal state
====[[Null Object Design Pattern]]===
+
====[[Null Object Design Pattern]]====
 
Designed to act as a default value of an object
 
Designed to act as a default value of an object
====[[Observer Design Pattern]]===
+
====[[Observer Design Pattern]]====
 
A way of notifying change to a number of classes
 
A way of notifying change to a number of classes
====[[State Design Pattern]]===
+
====[[State Design Pattern]]====
 
Alter an object's behavior when its state changes
 
Alter an object's behavior when its state changes
====[[Strategy Design Pattern]]===
+
====[[Strategy Design Pattern]]====
 
Encapsulates an algorithm inside a class
 
Encapsulates an algorithm inside a class
====[[Template method Design Pattern]]===
+
====[[Template method Design Pattern]]====
 
Defer the exact steps of an algorithm to a subclass
 
Defer the exact steps of an algorithm to a subclass
====[[Visitor Design Pattern]]===
+
====[[Visitor Design Pattern]]====
 
Defines a new operation to a class without change
 
Defines a new operation to a class without change
  

Revision as of 07:55, 6 June 2018

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 source or machine code. It is a description or template for how to solve a problem that can be used in many different situations. Design patterns are formalized best practices that the programmer can use to solve common problems when designing an application or system.

Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Patterns that imply mutable state may be unsuited for functional programming languages, some patterns can be rendered unnecessary in languages that have built-in support for solving the problem they are trying to solve, and object-oriented patterns are not necessarily suitable for non-object-oriented languages.

Design patterns may be viewed as a structured approach to computer programming intermediate between the levels of a programming paradigm and a concrete algorithm. for more..[1].

Classification and list

Creational patterns

These design patterns are all about class instantiation. This pattern can be further divided into class-creation patterns and object-creational patterns. While class-creation patterns use inheritance effectively in the instantiation process, object-creation patterns use delegation effectively to get the job done.

Abstract Factory Design Pattern

Creates an instance of several families of classes

Builder Design Pattern

Separates object construction from its representation

Factory Method Design Pattern

Creates an instance of several derived classes

Object Pool Design Pattern

Avoid expensive acquisition and release of resources by recycling objects that are no longer in use

Prototype Design Pattern

A fully initialized instance to be copied or cloned

Singleton Design Pattern

A class of which only a single instance can exist

Structural patterns

These design patterns are all about Class and Object composition. Structural class-creation patterns use inheritance to compose interfaces. Structural object-patterns define ways to compose objects to obtain new functionality.

Adapter Design Pattern

Match interfaces of different classes

Bridge Design Pattern

Separates an object’s interface from its implementation

Composite Design Pattern

A tree structure of simple and composite objects

Decorator Design Pattern

Add responsibilities to objects dynamically

Facade Design Pattern

A single class that represents an entire subsystem

Flyweight Design Pattern

A fine-grained instance used for efficient sharing

Private Class Data Design Pattern

Restricts accessor/mutator access

Proxy Design Pattern

An object representing another object

Behavioral patterns

These design patterns are all about Class's objects communication. Behavioral patterns are those patterns that are most specifically concerned with communication between objects.

Chain of Responsibility Design Pattern

A way of passing a request between a chain of objects

Command Design Pattern

Encapsulate a command request as an object

Interpreter Design Pattern

A way to include language elements in a program

Iterator Design Pattern

Sequentially access the elements of a collection

Mediator Design Pattern

Defines simplified communication between classes

Memento Design Pattern

Capture and restore an object's internal state

Null Object Design Pattern

Designed to act as a default value of an object

Observer Design Pattern

A way of notifying change to a number of classes

State Design Pattern

Alter an object's behavior when its state changes

Strategy Design Pattern

Encapsulates an algorithm inside a class

Template method Design Pattern

Defer the exact steps of an algorithm to a subclass

Visitor Design Pattern

Defines a new operation to a class without change

Concurrency patterns

Design patterns represent the best practices used by experienced object-oriented software developers. Design patterns are solutions to general problems that software developers faced during software development. These solutions were obtained by trial and error by numerous software developers over quite a substantial period of time.


Gang of Four (GOF)

Design Patterns

Creational

Structural

Enterprise Integration Design Patterns