Tuesday, March 14, 2006

Framework Design Guidelines

A couple of weeks ago I found a book on Amazon that looked interesting.  “Framework Design Guidelines” by Krzysztof Cwalina and Brad Abrams is part of the Microsoft .NET Development Series.  The authors have been involved in the design and development of the CLR and .NET Framework since the beginning and the experience and insight of those years comes through in a style that is easy to read.  This is not a book about .NET technology or how to program the latest features .NET has to offer.  It is about best practices when developing libraries of code.  

Sprinkled throughout the pages are comments by Brad and Krzysztof, Paul Vick, Anders Hejlsberg, Rico Mariani, Brent Rector, Chris Anderson, Jeffrey Richter, and others that give an almost conversational feel to the topics.  You can almost imagine yourself sitting around with a bunch of Microsoft architects discussing the pros and cons of naming conventions, the contents of namespaces, what makes a library easy to use and reusable, factoring high-level and low-level APIs, requirements and goals, and a host of other topics.  If you have experience with .NET, their discussions sound immediately familiar and the insight of why choices were made and compromises reached gives you an understanding of what a huge undertaking it was to develop the framework.  They really made an effort to get the framework right, and throughout the book they discuss their successes and the areas where they fell short.

The guidance is presented as a set of recommendations using Do, Consider, Avoid, and Do Not.  Do means always follow the guidance unless you have a really unusual case; Consider is for guidance you would usually want to follow; Avoid is for things that are generally not a good idea; and Do Not is reserved for those things that should almost never be done.  Along with the recommendations are explanations of why they are good or bad practices.

This book is packed with recommendations on all areas of framework design.  Areas covered include Qualities of a Well-Designed Framework, Framework Design Fundamentals, Naming Guidelines, Type Design Guidelines, Member Design, Designing for Extensibility, Exceptions, Usage Guidelines, and Common Design Patterns, followed by three appendices on C# Coding Style Conventions, Using FxCop to Enforce Design Guidelines, and a Sample API Specification.  Reading this book will make you a better framework designer and your libraries will be easier to use and more consistent.  I highly recommend it for the information, insight into framework design, and being an enjoyable read.

0 Comments:

Post a Comment

<< Home