What is a Design Pattern?
According to MSDN, "A design pattern is a description of a set of interacting classes that provide a framework for a solution to a generalized problem in a specific context or environment. In other words, a pattern suggests a solution to a particular problem or issue in object-oriented software development.”
What are actually the main benefits of Design Patterns?
The main benefits of design patterns in software development are:
- Adaptability to change
When should we use Design Patterns?
Design Patterns are frequently useful in one of the following cases.
- When the software application can change in definite span of time.
- When thesoftware application contains source code that involves event notification and object creation.
When should we not use Design Patterns?
Design patterns are not recommended in any of the following scinareos.
- When the software application being developed would not change with time.
- When the requirements of the source code of the application are unique.
If any condition of the above applies in the current design, there is no need to apply design patterns in the current design and avoid unnecessary complexity in the design.
What are “The Gang of Four” (GOF) Patterns?
The design patterns that we commonly use today can be attributed to the marvelous work following four persons:
- Erich Gamma
- Richard Helm
- Ralph Johnson
- John Vlissides.
These persons invented 23 design patterns in all that are commonly known as the Gang of Four patterns or the GOF patterns.
What are the Creational Patterns?
The Creational Patterns mainly deal with the best possible solution of creating an object or an instance of a class. They simply provide an object creation which is a flexible approach towards object creations. The following patterns are the sub-patterns of this group.
- Abstract Factory
Abstract Factory and the Factory pattern have the same purpose. The Singleton Pattern shows that there can be only single instance of a class throughout the Application’s life cycle. A singleton class is one that can be instantiated only once in the application domain and provides a global point of access to it.
What are the Structural Patterns?
The Structural Patterns provides the flexibility to specify how all the objects and classes can be interoperated. The following are the sub patterns of Structural Patterns group.
What are Behavioral Patterns?
Behavioral patterns can help you define a structure for inter-object communication between objects in a system. This design pattern is particularly used to monitor the transmission of messages when the objects communicate in a system. The following are the sub patterns of Behavioral Patterns.
- Chain of Responsibility
- Template Method Visitor
What is Model View Controller(MVC) Pattern in ASP.NET?
MVC consists of three kinds of objects
- The Model is an application object.
- The View is the presentation.
- The controller defines the way the user interface responds to user inputs It is a framework that allows developers to apply the MVC pattern in the development of an ASP.NET application, thus allowing a better separation of concerns, which results in better reusability and easier testing.
- The request comes from the client and hits the Controller.
- The Controller calls the Model in order to perform some "business" operations.
- The Model returns the results of the operations back to the Controller.
- The Controller decides which View needs to be rendered and sends it the data that must be rendered.
- Finally the View renders the output and sends the response back to the client.
What design patterns are? Why wonder now..In this article, I have explained why design patterns are important, and provided some examples