Design Patterns in C#

Design Patterns in C#

Design pattern is a general reusable solution to a commonly occurring problem within Software Design.
Design patterns can speed up the development process by providing tested, proven development concepts.Reusing design patterns helps to prevent subtle issues that can cause major problems, and it also improves code readability for developers.

In Design Pattern, Each pattern describes a problem which 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

Patterns capture the static and dynamic structures and collaborations of successful solutions to problems that arise when
building applications in a particular domain.

Design Patterns involves four items:
• The name of the pattern
• The purpose of the pattern, the problem it solves
• How we could accomplish this
• The constraints and forces we have to consider in order to
    accomplish it

Types of Design Patterns,

Creational Patterns:
Deals with initializing and configuring classes and objects. Creational design patterns solve this problem by somehow controlling this object creation.
Abstract factory pattern:  which provides an interface for creating related or dependent objects without specifying the objects' concrete classes
Builder pattern : which separates the construction of a complex object from its representation so that the same construction process can create different representation.
Factory method pattern : which allows a class to defer instantiation to subclasses.
Prototype pattern : which specifies the kind of object to create using a prototypical instance, and creates new objects by cloning this prototype.
Singleton pattern : which ensures that a class only has one instance, and provides a global point of access to it.