design-patterns

Command - The Daily Design Pattern

This is part of a series of posts demonstrating software design patterns using C# and .NET. The patterns are taken from the book Design Patterns by the Gang of Four. Here's the series index page. What Is This Pattern? The Command design pattern encapsulates a request as an object, thereby allowing us developers to treat that request differently based upon what class receives said command. Further, it enables much more complex architectures, and even enables operations such as undo/redo.... Read more >

Mediator - The Daily Design Pattern

This is part of a series of posts demonstrating software design patterns using C# and .NET. The patterns are taken from the book Design Patterns by the Gang of Four. Here's the series index page. What Is This Pattern? The Mediator design pattern defines an object which encapsulates how a set of objects interact with each other. You can think of a Mediator object as a kind of traffic-coordinator; it directs traffic to appropriate parties based on its own state... Read more >

Composite - The Daily Design Pattern

This is part of a series of posts demonstrating software design patterns using C# and .NET. The patterns are taken from the book Design Patterns by the Gang of Four. Here's the series index page. What Is This Pattern? The Composite design pattern represents part-whole hierarchies of objects. "Part-whole hierarchies" is a really fancy way of saying you can represent all or part of a hierarchy by reducing the pieces in said hierarchy down to common components. When using this... Read more >

Visitor - The Daily Design Pattern

This is part of a series of posts demonstrating software design patterns using C# and .NET. The patterns are taken from the book Design Patterns by the Gang of Four. Here's the series index page. What Is This Pattern? The Visitor pattern lets us operate on objects by representing that operation as an object unto itself. Thereby, we can operate on said objects without changing the classes or definitions of those objects. This pattern is particularly useful when, for one... Read more >

Chain of Responsibility - The Daily Design Pattern

This is part of a series of posts demonstrating software design patterns using C# and .NET. The patterns are taken from the book Design Patterns by the Gang of Four. Here's the series index page. What Is This Pattern? The Chain of Responsibility design pattern seeks to avoid coupling a request to a particular receiver by giving more than one object a chance to handle a particular request. In essence, we pass an object along a "chain" of potential handlers... Read more >

Decorator - The Daily Design Pattern

This is part of a series of posts demonstrating software design patterns using C# and .NET. The patterns are taken from the book Design Patterns by the Gang of Four. Here's the series index page. What Is This Pattern? The Decorator design pattern seeks to add new functionality to an existing object without changing that object's definition. In other words, it wants to add new responsibilities to an individual instance of an object, without adding those responsibilities to the class... Read more >