Because of my involvement with the Design Guidelines effort I often get asked about “coding conventions” such as tab v. spaces, where to put the open brace, etc. My usual policy is not the chime in… these issues have a ton of religion around them and little value to external customers. But I, I was asked by one of my readers so thought I’d write a little about how the Framework organizes it’s source code and what works and what doesn’t. Essentially the idea is to have a root directory for each assembly MsCorLib, System.Dll, System.Web.Dll, etc. In those directories we have subdirectories for each namespace and each type gets its own cs file.
So String would be in:
And FileStream would be in:
This is an organizational structure that helps a ton in terms of finding and separating source. You can see this yourself if you look at the Rotor source.
As we got close to the end game for V1, we broke this pattern in the framework tree when we refactored types into several different assemblies, and merged some other assemblies into one (mostly for performance reasons). There are a few assemblies such as System.dll that now pull in code from ~6 different directories scattered throughout the tree. It takes a lot more effort (or memorization) to find types the source for types that live System.dll. Our dev team is not crazy about that as it increases the time to find the source for types…mostly they give up and type “dir /s”. At least we generally keep to one class per file, so “dir /s” is usually successful.