C# – How to Choose a Good Namespace Name?

cnamespacenet

English in not my native language, therefore it is a little more difficult to pick a good name for a namespace. One example to make you see my problem a bit better:

We have a set of classes that have to do with the way a company is organized (we can create organizational charts with it). Currently the namespace is CFW.CoreSystem.Organizational. Is this a good name?

What is linguistically the best way to name a namespace? (CFW.CoreSystem.Configuration is better than CFW.CoreSystem.Configurables).

[Moved it from StackOverflow]

Best Answer

The name chosen for a namespace should indicate the functionality made available by types in the namespace. For example, the System.Net.Sockets namespace contains types that enable developers to use sockets to communicate over networks.

The general format for a namespace name is as follows:

<Company>.(<Product>|<Technology>)[.<Feature>][.<Subnamespace>]

For example, Microsoft.WindowsMobile.DirectX.

Do use Pascal casing, and separate namespace components with periods (for example, Microsoft.Office.PowerPoint). If your brand employs nontraditional casing, you should follow the casing defined by your brand, even if it deviates from normal namespace casing.

Consider using plural namespace names where appropriate. For example, use System.Collections instead of System.Collection. Brand names and acronyms are exceptions to this rule, however. For example, use System.IO instead of System.IOs.

Do not use the same name for a namespace and a type in that namespace. For example, do not use Debug for a namespace name and also provide a class named Debug in the same namespace. Several compilers require such types to be fully qualified.

There are lots of Do or Do'not detail on MSDN regarding Naming of namespace, Assemblies etc. Check this out for Namespaces

CFW.CoreSystem.Configuration is better.

The Namespace CFW.CoreSystem.Organizational is pretty good but CFW.CoreSystem.Organization is much better to write.