C# 3.0 Design Patterns

Author: Judith Bishop
Publisher: O’Reilly, 2008
Pages: 314
ISBN: 978-0596527730
Aimed at: Developers wanting to improve their C# skills
Rating: 3
Pros: GoF Patterns in C#
Cons: Contrived examples
Reviewed by: Dave Wheeler

The famous “Gang of Four” design patterns have been much written about over the past decade or so, with excellent works such as the Head First Design Patterns being one of the foremost. The only problem being that the patterns have rarely been presented in C#.

Bishop has chosen to provide examples of all 23 of the GoF patterns using modern C# 3.0 as her implementation language, attempting to fold in C# 3.0 information as appropriate. I actually found this slightly jarring. Small, introductory discussions of C# language features have no real place in this type of book unless they directly relate to a pattern; many of these seemed to have been thrown in because an example happened to use them, and perhaps Bishop was unsure of whether the reader would understand the code.

More seriously, the examples chosen to highlight the patterns were weak and hardly live up to the “Use of the Power of C# 3.0 to Solve Real-World Problems” billing on the front cover.

Obviously Bishop loves the Apple Mac, and cartoons, but in many cases these provided no enlightenment on the pattern at hand. Similarly, there is only superficial coverage of many patterns, with no ongoing explanation of potential pitfalls. By way of example, there was no examination of the use of weak references for Observer to avoid potential lifetime problems, nor were there any examples of thread-safe Singletons (or even of the many different variants of Singleton that are seen in the wild).

I was also very disappointed to find that Bishop hadn’t taken the trouble to identify good examples of the patterns within the .NET Framework.

This book is neither good nor bad; but I wouldn’t recommend it to someone interested in studying patterns. As an introduction, the Head First book is better; for detail, the GoF book is fine; and there are excellent examples of the patterns on the Web with far greater depth and coverage.