Difference between revisions of "Design Patterns"
Line 8: | Line 8: | ||
==Classification and list== | ==Classification and list== | ||
===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. | ||
+ | ====[[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=== | ===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=== | ===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=== | ===Concurrency patterns=== | ||
Revision as of 08:53, 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].
Contents
- 1 Classification and list
- 1.1 Creational patterns
- 1.2 =Abstract Factory Design Pattern
- 1.3 =Builder Design Pattern
- 1.4 =Factory Method Design Pattern
- 1.5 =Object Pool Design Pattern
- 1.6 =Prototype Design Pattern
- 1.7 =Singleton Design Pattern
- 1.8 Structural patterns
- 1.9 =Adapter Design Pattern
- 1.10 =Bridge Design Pattern
- 1.11 =Composite Design Pattern
- 1.12 =Decorator Design Pattern
- 1.13 =Facade Design Pattern
- 1.14 =Flyweight Design Pattern
- 1.15 =Private Class Data Design Pattern
- 1.16 =Proxy Design Pattern
- 1.17 Behavioral patterns
- 1.18 =Chain of Responsibility Design Pattern
- 1.19 =Command Design Pattern
- 1.20 =Interpreter Design Pattern
- 1.21 =Iterator Design Pattern
- 1.22 =Mediator Design Pattern
- 1.23 =Memento Design Pattern
- 1.24 =Null Object Design Pattern
- 1.25 =Observer Design Pattern
- 1.26 =State Design Pattern
- 1.27 =Strategy Design Pattern
- 1.28 =Template method Design Pattern
- 1.29 =Visitor Design Pattern
- 1.30 Concurrency patterns
- 2 Gang of Four (GOF)
- 3 Design Patterns
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.