Expert Texture Home Contact me About Subscribe Digipede Connect on LinkedIn rwandering on Twitter rwandering on FriendFeed

The blogged wandering of Robert W. Anderson

Framework Design Guidelines (MiniReview)

I just finished the Framework Design Guidelines book by Krzysztof Cwalina and Brad Abrams.

This is an excellent book. I recommend it to any and all .NET developers interested in improving the style, consistency, and maintainability of their class libraries — public or not. While it is certainly targeted at designers of public frameworks, there is a lot of good content here for everybody. Note that most of the book applies to .NET 1.1, but there is a clear preference for .NET 2.0 in the discussions about proper implementation of collections and lists using generics.

  • It provides guidelines for nearly all aspects of .NET Framework design. For example, proper naming, framework extension, use of abstract classes versus interfaces, methods and proper overloading, attributes, when to throw exceptions versus returning failure, asynchronous patterns, event raising patterns, etc. . . It also points out when a guideline conflicts with performance.
  • It contains insight into some of the design choices in the .NET Framework itself. While certainly not comprehensive in this regard, it does provide insight into some of the decisions (and even some of the mistakes) that were made in .NET. For example, it explains what ICloneable is doing in there. Nothing good it turns out. 😉
  • Most (if not all) guidelines are annotated with comments by different .NET luminaries. All in all, I find this style interesting though the annotations do sometimes conflict. One example can be found of this on Brad Abrams’ blog (Framework Design Guidelines Class name prefixes). Of course, the annotations do not define the guideline — they shed light on how decisions were made, on ongoing debates, and they provide examples. In some other cases, I feel that the annotations shouldn’t have been included because they essentially echo the guideline. This just makes the book unnecessarily repetitive.
  • It comes with a DVD including a series of videos explaining many of the points in the book. This video series appears to be part of an internal push at Microsoft to standardize on Framework design across the entire company (i.e., beyond the .NET Framework). As the lead designer of the Digipede Framework SDK, I viewed these videos on MSDN many months back and handed them off to my development team to make sure they saw them too. Again, the content is targeted at framework designers, but the videos have obvious value about the workings of .NET and the CLR.
  • There is an appendix on bracing and spacing style. Of course this has little intersection with public frameworks (outside of docs and sample code); however, it is refreshing to see Microsoft back some kind of standard. I know that formatting generally comes down to individual choice (and sometimes people treat it as a religious one); however, it would be useful if, like naming conventions, .NET developers adopted a standard for bracing and spacing. Even better that the standard outlined in this book is almost exactly the one I promote! One question: why does VS2005 format code using a different standard? I can guess as to the answers, but it is unfortunate.

Anyway, this is a very good book worth the price of a hardcover edition.

1 Comment »

[…] You can read it here. […]

Your comment

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>