behavioral-patterns

Design patterns which are concerned with the behavior of and communication between objects.

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 >

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... Read more >

Strategy - 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 Strategy design pattern defines a family of algorithms, then makes them interchangeable by encapsulating each as an object. Consequently, the actual operation of the algorithm can vary based on other inputs, such as which client is using it. The basic... Read more >

State - 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 State design pattern seeks to allow an object to change its own behavior when its internal state changes. In this pattern, the "states" in which an object can exist are classes unto themselves, which refer back to the... Read more >

Memento - 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 Memento pattern seeks to capture and externalize and object's state so that the object can be restored to this state at a later time. The purpose of this pattern is to separate the current state of the object from a... Read more >

Observer - 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 Observer pattern seeks to allow objects to notify their observers when their internal state changes. This means that a single object will need to be aware of the objects that observe it, and need to be able to communicate to... Read more >
/* * * DON'T EDIT BELOW THIS LINE * * */ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }());