Over the past few years I’ve been writing short, focused lessons on the design patterns I reach for most in C# and .NET. Patterns aren’t about memorizing UML diagrams — they’re a shared vocabulary for the trade-offs we make every day: where to put a seam, how to decouple two things that change at different rates, how to keep a distributed system reliable.
Below is the whole collection, organized by type. Each one links to a deeper lesson with code.
Creational Patterns
How objects get created — decoupling construction from use.
- Builder — Construct complex objects step by step, separating construction from the final representation.
- Factory Method — Defer instantiation to subclasses so callers depend on an abstraction, not a concrete type.
- Abstract Factory — Produce families of related objects without naming their concrete classes.
- Prototype — Create new objects by cloning an existing instance.
- Singleton (multithreading) — Guarantee a single instance with thread-safe lazy initialization.
Structural Patterns
How objects are composed into larger structures.
- Adapter — Wrap an incompatible interface so two types can work together.
- Bridge — Decouple an abstraction from its implementation so both can vary independently.
- Composite — Treat individual objects and compositions of objects uniformly through a tree.
- Decorator — Add behavior to an object at runtime by wrapping it.
- Facade — Provide a simple entry point over a complex subsystem.
- Proxy — Stand in for another object to control access, add caching, or lazy-load.
Behavioral Patterns
How objects communicate and distribute responsibility.
- Chain of Responsibility — Pass a request along a chain of handlers until one handles it.
- Command — Encapsulate a request as an object you can queue, log, or undo.
- Memento — Capture and restore an object’s state without exposing its internals.
- Observer — Notify dependents automatically when the subject’s state changes.
- State — Let an object change its behavior when its internal state changes.
- Strategy — Swap interchangeable algorithms behind a common interface.
- Template Method — Define an algorithm’s skeleton and let subclasses fill in the steps.
- Visitor — Add operations to an object structure without modifying its classes.
Architectural & .NET Patterns
Patterns that show up at the application and system level — several of them specific to building reliable services in .NET.
- CQRS — Separate read and write models so each can scale and evolve on its own.
- Options (IOptions) — Bind and inject strongly-typed configuration in .NET.
- REPR — Structure endpoints as Request–Endpoint–Response for clean vertical slices.
- Service Collection Extension — Group related dependency-injection registrations into tidy extension methods.
- Saga Orchestration — Coordinate long-running distributed transactions with compensating actions.
- Outbox — Reliably publish messages by committing them in the same transaction as your data.
- Circuit Breaker (resilient APIs) — Stop hammering a failing dependency and fail fast to keep the system resilient.
That’s 26 patterns in total. None of them are silver bullets — the skill is recognizing the situation that calls for one, and knowing the cost of reaching for it. Start with the problem, not the pattern.