This is the last version of MVC from the .NET Framework. The next version was first called MVC 6 but was later renamed to ASP.NET Core MVC and moved to .NET Core. So, let's start by learning ASP.NET MVC 5.
Design Patterns
Design patterns are best practices used by experienced object-oriented software developers. They are solutions to common problems in software development, based on the knowledge and experience of many developers over time. These patterns have improved and provide the best solutions to specific problems. Learning these patterns helps less experienced developers understand and use effective design techniques more easily. Design patterns solve design problems that often come up in real-world application development.
What is the Gang of Four (GoF)?
In 1994, four authors—Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides—published a book titled Design Patterns: Elements of Reusable Object-Oriented Software. This book introduced the concept of design patterns in software development. The authors are collectively known as the Gang of Four (GoF). The book is divided into two parts: the first part discusses the "Pros and Cons" of Object-Oriented Programming, and the second part explains the evolution of 23 software design patterns.
Types of Design Patterns
According to the reference book Design Patterns: Elements of Reusable Object-Oriented Software, there are 23 design patterns, which can be classified into three categories: Creational, Structural, and Behavioral patterns.
Creational Patterns: These design patterns provide a way to create objects while hiding the creation logic, rather than instantiating objects directly using the new operator. This gives the program more flexibility in deciding which objects need to be created for a given use case.
Abstract Factory: Creates an instance of several families of classes.
Builder: Separates object construction from its representation.
Factory Method: Creates an instance of several derived classes.
Prototype: A fully initialized instance to be copied or cloned.
Singleton: A class of which only a single instance can exist.
Structural Patterns: These design patterns deal with class and object composition. Inheritance is used to compose interfaces and define ways to combine objects to create new functionalities.
Adapter: Matches interfaces of different classes.
Bridge: Separates an object’s interface from its implementation.
Composite: A tree structure of simple and composite objects.
Decorator: Adds responsibilities to objects dynamically.
Facade: A single class that represents an entire subsystem.
Flyweight: A fine-grained instance used for efficient sharing.
Proxy: An object representing another object.
Behavioral Patterns: These design patterns are specifically concerned with communication between objects.
Chain of Responsibility: A way of passing a request between a chain of objects.
Command: Encapsulates a command request as an object.
Interpreter: A way to include language elements in a program.
Iterator: Sequentially accesses the elements of a collection.
Mediator: Defines simplified communication between classes.
Memento: Captures and restores an object's internal state.
Observer: A way of notifying changes to several classes.
State: Alters an object's behavior when its state changes.
Strategy: Encapsulates an algorithm inside a class.
Template Method: Defers the exact steps of an algorithm to a subclass.
Visitor: Defines a new operation on a class without changing the class itself.