Design pattern is a proven design solution to a common problem faced by software developers. Design Patterns are about design and interaction of objects. Design patterns became popular with the rise of object oriented analysis and design (OOAD). They provide a communication platform concerning elegant, reusable solutions to commonly encountered programming challenges.
Design patterns are designed to help developers deliver higher quality, more easily maintained software products in less time and at lower cost. Design Patterns can solve problems by providing a framework for building a cleaner and more efficient application. classification of design patterns
- Behavioral design patterns
- Creational design patterns
- Structural design patterns
There are three design pattern
Behavioral Patterns define the behavior of the classes involved. The popular behavioral patterns include Chain of R esponsibilities, Interpreter, Mediator, Iterator, Observer, etc and it characterize the manner of class and object interaction and how responsibilities are distributed among them. Observer pattern involves a one-many dependency between objects where a change in an object(subject) needs to be notified to all it's dependents(observers).
This is a very popular creational pattern which restricts a class to have only one instance and it is address the object creation process. Creational design patterns encapsulate knowledge about how, when, and by whom an instance is created.
Address the composition of classes and objects.Structural patterns depend on the structure of the classes involved. There are many structural patterns like Adapter, Builder, Decorator, etc.
There are following of the design patterns used with .NET
A) Creational Patterns
- Factory Method
- Abstract Factory
- Builder
- Prototype
- Singleton
B) Structural Patterns
- Adapter
- Bridge
- Composite
- Proxy
C) Behavioral Patterns
- Iterator
- Observer
- Enable large scale reuse of S/W
- Helps in improve developer communication.They consume more memory because of generalised format they are written, to store any kind of data.
- capture expert knowledge and design trade-offs and make expertise widely available
- Reusing design patterns helps to prevent subtle issues that can cause major problems, and it also improves code readability for coders and architects who are familiar with the patterns.
- A standard solution to a common programming problem enable large scale reuse of S/W
- Do not lead to direct code reuse
- Complex in nature and Design patterns may increase or decrease the understandability of a design or implementation.
- they are deceptivrly simple.
- they are validated by experince and discussion.
- They can decrease understandability by adding indirection or increasing the amount of code.