Difference between revisions of "Design Patterns"
(Created page with "Design patterns provide general solutions to software design problems we find in real-world application development. Before starting with design patterns let's understand wha...") |
|||
| Line 11: | Line 11: | ||
== Creational Design Pattern == | == Creational Design Pattern == | ||
| + | In software engineering, creational design patterns are design patterns that deal with '''object creation mechanisms''', trying to create objects in a manner suitable to the situation. The basic form of object creation could result in design problems or added complexity to the design. Creational design patterns solve this problem by somehow controlling this object creation. | ||
=== Factory Method === | === Factory Method === | ||
=== Abstract Factory === | === Abstract Factory === | ||
| Line 16: | Line 17: | ||
=== Prototype === | === Prototype === | ||
=== Singleton === | === Singleton === | ||
| + | The singleton pattern is a software design pattern that restricts the instantiation of a class to one '''single''' instance. This is useful when exactly one object is needed to coordinate actions across the system. | ||
| + | |||
== Structural Design Patterns == | == Structural Design Patterns == | ||
=== Adapter === | === Adapter === | ||
Revision as of 12:36, 13 October 2019
Design patterns provide general solutions to software design problems we find in real-world application development.
Before starting with design patterns let's understand what the meaning of design patterns and why they are useful in software programming/architecture.
"Each pattern describes a problem that occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice." - Christopher Alexander, A Pattern Language.
It is important to understand design patterns rather than memorizing their classes, methods and properties. First identify the software design problem then see how to address these problems using design patterns and determine the best suited design problem to solve the problem.
There are 23 design patterns, also known as Gang of Four (GoF) design patterns. The Gang of Four are the authors of the book, "Design Patterns: Elements of Reusable Object Oriented Software".
Creational Design Pattern
In software engineering, creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. The basic form of object creation could result in design problems or added complexity to the design. Creational design patterns solve this problem by somehow controlling this object creation.
Factory Method
Abstract Factory
Builder
Prototype
Singleton
The singleton pattern is a software design pattern that restricts the instantiation of a class to one single instance. This is useful when exactly one object is needed to coordinate actions across the system.
