Design Patterns in C#
Introduction
Featured above are 7 design patterns given with example source code and a brief summary and example code. The idea is to keep the summary and example brief, serving as an overview instead of an in-depth description of each. If you are after more detailed information on each pattern have a look at the links section at the end of the article, which includes books. These books along with the information online are where I've based my source code and descriptions from, and also from using them over the years -sometimes without realising its a known pattern and other times deliberately.
I haven't included any UML class diagrams to try to keep the article concise. If you find UML explains the class/interface relationships better then the Gang of Four and O'Reilly C# books all contain these and are definitely worth investing in. Or you can read the codeproject articles. The patterns aren't categorised either as you'll see.
The code examples below is generally just the pattern itself (i.e. the classes/interfaces involved in the pattern) and not the types in use. The download link above contains a full solution of all 7 patterns (in Visual Studio 2008 format) with usage, so it's recommended you download this to get a clearer picture.
Links
MSDN article about the design patterns you've been using in the .NET framework perhaps without knowing.
A series on design patterns in C#, with UML diagrams and categorised like the gang of four book into creational, behavioural, structural patterns.
Scroll to the bottom of the page for a list of patterns. Features some clear and concise example source code, mostly in Java.
The original "gang of four" book, has clear descriptions and UML class diagrams.
Quite a decent book with UML diagrams of each pattern. A little bit patchy with code examples in places, and the code is far from the FX-cop standards.
The author of Patterns of Enterprise Application Architecture, another patterns book geared at software for the "enterprise" (not star trek).
Last updated on 02 February 2009
Comments
blog comments powered by