Home > Articles > Programming > Windows Programming

Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries: Video Podcast Transcript

In this transcription of an OnMicrosoft session, authors Brad Abrams and Krzysztof Cwalina discuss how they arrived at the changes in the second edition of their book Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries.
Like this article? We recommend

View the original Video Podcast.

Welcome to OnMicrosoft—conversations with thought leaders in Microsoft technologies. In this session, Brad Abrams and Krzysztof Cwalina discuss Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries, Second Edition, the definitive resource for .NET developers and architects designing class library frameworks—updated for the new language features of the .NET Framework 3.0 and 3.5.

Brad Abrams: Hi, I'm Brad Abrams, an employee at Microsoft. I'm here at the sunny Redmond campus [with my coauthor Krzysztof Cwalina], talking about our new book, Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries, Second Edition. Krzysztof, what do you think are the key new things that we got a chance to put in this [edition]?

Krzysztof Cwalina: We published the first edition of the book several years ago, and that was right after .NET Framework, I think 2.0 or so.

Brad: [Version] 2.0 had just shipped, yeah.

Krzysztof: The book was really successful, people found it useful, but now the framework moved forward. We have new features both in the runtime and in the core platform, and there was just a need to update [the book]. The framework has changed, and the rules for designing libraries that integrate well with the framework have changed.

Brad: [We've made] a bunch of additions to the book, but I was impressed that even after the last six or so years as we've been seriously working on the guidelines, I don't think a single guideline substantively changed. We added a bunch of new [guidelines], but by and large the body of work stayed the same.

Krzysztof: The guidelines are like framework libraries—you don't want to break framework libraries as [you go] to release. And to avoid breaking changes, you cannot change the rules [in] the way you design the framework. You cannot tell people, "This is how you design today. And, by the way, next version, your design is going to be wrong." Correct?

Brad: Yeah, yeah.

Krzysztof: So we are very careful about avoiding resets. That requires a lot of thought before we actually put guidelines into the official book. We do it by basically trying things in real life, in the real framework; doing postmortem or thinking about how we arrived at the design—what were the good parts of the design, what [were] not; and then applying those guidelines.

Brad: Another classic example: [For] several sections of the book in the first edition, we got feedback [that] some things were harder to understand, and we were having to explain more than we like. For example, the exceptions section [got a wholesale rewrite]. Didn't change any of the guidelines, but certainly explained things in a lot clearer manner.

Krzysztof: Yeah, exactly. Exceptions design is something that you know many books and articles have been written about, and it's a very difficult subject. I think our first attempt at describing the exception space was a good effort.

Brad: Valiant effort.

Krzysztof: But some parts of the exceptions chapter were not explaining the issues in an easy-to-understand way. After a few years of experience, we know how to explain it better, and that was one of the chapters that was significantly updated.

Brad: You mentioned that we wrote [the first edition of] this book shortly after .NET Framework 2.0 shipped. The second edition basically covers the framework features that we put in since then. We're not teaching how to use these features; what we're doing is saying—based on years and years of experience, from countless people using the features—the best practices that have emerged. For example, we have some LINQ usage guidelines.

Krzysztof: Yes—but, as you said, they're not about how to use LINQ. They're mostly about, "I want to integrate my library with LINQ—and what are the API design techniques and maybe interfaces that I need to implement to achieve integration?"

Brad: Overall the book is a good mix of philosophical design points ("Generally, this is how to think about this") as well as super-pragmatic things ("Implement this interface, throw this exception")—you know, very concrete, so I think the book does a good job of tying those together.

Krzysztof: Exactly. I think that's the main value of the book. As you said, there are many books that describe framework features and how to use them.

Brad: Right.

Krzysztof: We could not create a book that is the definitive guide to using the .NET Framework—every single feature that you see in the .NET Framework.

Brad: We should work on that next—that should be our next tome.

[Both laugh.]

Krzysztof: But what we attempted to do was create a book that is the definitive guide for creating crosscutting kind of designs in framework libraries.

Brad: Yeah, yeah.

Krzysztof: But now, the danger is going too far into the philosophy. We wanted to avoid [that], and that's why the format of the book is such that we have very actionable guidelines. Basically there is almost no prose—"Oh! We think that this is the philosophy," and whatnot. A majority of the book is basically simple bullets: Do that, do not do this, avoid that, consider doing this. And of course justification is very important, so for each of these bullets we have justification—because, frankly, I myself cannot follow rules, unless I understand the reason behind the rule.

Brad: Yes.

Krzysztof: So those are the kind of elements or techniques that we use to explain [the] sometimes very difficult concepts in framework design.

Brad: Absolutely. People at conferences [have told me] that this book is very well suited to give to line developers and say, "This is our best practices." Put it on their desk, and they can make sense of it and apply it directly. The other thing this [book] does is—you know, people have these guidelines. Every company, every group has a set of guidelines. We save you hours of argument. You don't have to argue about these things [because you can just follow] what it says in the book. At least you know then that you're going to be consistent with the bulk of the .NET Framework. The purpose, the reason we wrote [the book] is to help Microsoft build out the actual .NET Framework. It's sort of a side benefit that we get a book out of it.

Krzysztof: Exactly. Half of the guidelines are basically what I call "conventions." I was talking about having a reason. For many of those [conventions], the reason is, this is how we chose to design libraries. You know, there is no better or worse way. [For example,] case identifiers: We just chose one way, and the reason for following the guideline is being consistent.

Brad: That's right.

Krzysztof: Then there's a second set of guidelines, which are basically written after our experiences of designing one of the largest reusable frameworks ever created. Not many people could experience designing something like that. [A] lot of people in the .NET Framework team contributed [to the guidelines]; they were the domain experts for many of the guidelines. The book is basically holding the common knowledge of designers of the .NET Framework.

Brad: I think of us as the custodians of the knowledge. Whenever we write this book, we are the custodians—we help gather it, put it together. As you said, there were people who contributed directly, actually wrote the section, and then we also benefit from just being around there working with lots of people who are designing parts of the framework, designing those features, and we can make sure that there's very direct "first person" input on what we've done.

Krzysztof: Right.

Brad: The other thing I really like about the book is the annotation section. Many of the guidelines could be a little dry at times, so having annotations by leading industry experts really gives some color and some flavor to the text.

Krzysztof: Going back to the rationale behind the guidelines: No matter how much we could write rationale below the bullet describing a rule, [because] we didn't have that many annotations it was very difficult to convey all the tradeoffs that you have to make, and tradeoffs are a big part of the rationale.

Brad: Absolutely.

Krzysztof: I think by having annotations from experts, sometimes disagreeing with each other—

Brad: Not disagreeing, [more] a kind of nuanced opinion.

Krzysztof: Exactly. Having slightly different opinions points at the tradeoffs that API designers have to make, even if they apply some of the "do or do not" guidelines.

Brad: Absolutely. Well, it was good to talk to you about the book; looking forward to maybe [a third edition] sometime.

Krzysztof: Yeah, maybe. Or maybe this big stack of books about how to use the .NET Framework.

Brad: Yeah, yeah. We'll get right on that.

For more information, visit onpodcastweekly.com and subscribe to all our podcasts. Brought to you by the publishing imprints and information portal of Pearson Education.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020