System.TimeZone2 Naming … and related design guidelines

There is an interesting discussion on the BCL blog about a new BCL type called TimeZone2.  Just take a look at the comments below the System.TimeZone2 Starter Guide post. The new type supersedes an existing type called TimeZone (which is obsolete now). Lots of people are not thrilled with the “2” suffix. I am responsible…


Clearing Enum Flags

UPDATE: It looks like I am confusing a lot of people with this article. I wanted to write an article about something else than the title suggests (how flags enum are built) but I did not explain it well and what’s more important I forgot to mention the most important thing: how to simply clear…


Poll: Attribute Design

I would like to run a quick poll. Which design do you prefer for a set of related attributes and why? Option #1: Several Attribute Types: public class AaaaFooAttribute: Attribute { } public class BbbbFooAttribute: Attribute { } public class CcccFooAttribute: Attribute { } public class DdddFooAttribute: Attribute { }   Option #2: One Attribute…


International Phonetic Alphabet

I am in Chicago at the Architecture and Design World, and today I went to a session on API design. The talk was given by Elliotte Rusty Harold, who wrote more books than I would ever guess (see his home page). The talk covered the most important do’s and don’ts of API design and was…


Architecture & Design World 2006

I will attending Architecture & Design World next week where  I hope to meet and chat with some fellow API designers.  Should be fun.


Choosing the Right Type of Exception to Throw

My last post about the ApplicationException resulted in some questions along the lines of “so, if not ApplicationException, what should I throw instead?” The answer to this question is partially covered by my old post on Exception Throwing and partially by some additional guidelines for creating custom exceptions that did not make it to the…


ApplicationException considered useless

We have a guideline that bans using the ApplicationException. Here is the related excerpt from the Framework Design Guidelines: ý Do not throw or derive from System.ApplicationException. JEFFREY RICHTER: System.ApplicationException is a class that should not be part of the .NET Framework. The original idea was that classes derived from SystemException would indicate exceptions thrown…


Synchronization at the Right Level

I get a lot of questions about why the new generic collection interfaces (IList<T> for example) do not support synchronization. There are several reasons for it. One, probably the main, is that in practice synchronizing on the level of a single data structure is rarely useful. Rico explains this in a series of posts on…


Framewok Design Guidelines Wins Productivity Award

A couple of months ago, Brad blogged about the FDG book getting into the Jolt Award finals. The winners were just announced and we have won the Productivity Award! I am shocked … that Brad did not blogged this information first! 🙂   On that occasion, I looked up some of the past winners of…


Framework Design Humor by Benji Smith

Benji wrote a pretty funny article exposing one of the main problems with bad APIs: trying to enable every single scenario at the wrong level of abstraction. In other words, when your APIs get too complex, think whether you are not trying to enable scenarios for which assembly level programming would be much better suited. And…