Book Review
Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries
By Krzysztof Cwalina and Brad Abrams
The more experience I gain, the more I value coding standards and design guidelines. When I read code that consistently follows a naming standard and is so easy to read you can spot common patterns and guess the 'rule' they follow (ie. using properties for wrapping fields instead of GetXxx and SetXxx methods), the better I feel the quality is. So when Microsoft published their paper Design Guidelines for Developing Class Libraries several years ago, I printed it out, put it in a three ring binder and read it from cover to cover. Since I was new to C# at the time, I thought it was great to actually have some naming standards and design guidelines to follow in my learning of this new language and technology. In the years since reading that document, I have often referred to it when starting a new project that needs some documented standards to follow. Now I don't have to use that document because it is now new and improved and bound into book form!
In addition to design guidelines for class libraries, this book goes further and focuses on designing frameworks. The authors have written the book in a unique style that not only communicates their message of framework design, but also weaves in comments of other experts throughout the book on different topics that gives you the feeling of being in a conversation.
Before diving into what it takes to make a well designed framework, some time is spent on explaining what is meant by ‘framework’ and different design principals that should be taken into account. As you read through the pages you feel like a fly on the wall at a design meeting about decisions that were made on the .Net framework. As the conversation (and the book) continues, you start to get to things like capitalization conventions, other naming conventions, coding standards and design guidelines. The book and comments explain a lot of decisions that were made in designing these guidelines (while designing the .Net framework). In case you are wondering, these comments I keep referring to are not all positive. Many comments bring up mistakes that were made and lessons that where learned.
The book covers many design guidelines that will help you in you own development, such as: type design, member design, exceptions, designing for extensibility and common design patterns. Do you ever wonder when you should make a class versus a struct or an interface? That is covered. How about details of what a static class is and when you should use it? That is covered. How about whether you should make a type nested or not? That too is covered. I am sure you get the point by now.
We all know it is hard staying consistent from design to implementation to refactoring. Developing reusable, easy to use, intuitive, and easy to support .NET libraries is not easy because of all the details that must be addressed. This book will help you tackle a large portion of those details, whether you are a new developer, senior developer or an architect. This is definitely a resource you should have on your bookshelf.