Explore common design patterns in .NET through practical examples.
Creational Patterns
- AbstractFactory - Provides an interface for creating families of related or dependent objects without specifying their concrete classes.
- Factory Method - Defines an interface for creating an object, but let subclasses decide which class to instantiate. This pattern lets a class defer instantiation to subclasses.
- Builder - Separates the construction of a complex object from its representation so that the same construction process can create different representations.
- Singleton - Ensures a class has only one instance and provide a global point of access to it.
- Prototype - Specifies the kind of objects to create using a prototypical instance, and create new objects by copying this prototype.
Structural Patterns
- Adapter - Converts the interface of a class into another interface clients expect. This design pattern lets classes work together that couldn‘t otherwise because of incompatible interfaces.
- Bridge - Decouples an abstraction from its implementation so that the two can vary independently.
Behavioral Patterns