namespace naming conventions

From the Namespace Naming Guidelines:

The general rule for naming namespaces
is to use the company name followed by
the technology name and optionally the
feature and design as follows. Copy
Code

CompanyName.TechnologyName[.Feature][.Design]

Generally it’s a really bad practice to start including things into the default namespace of a framework or library. This can cause confusion in terms of whether a new namespace is part of the existing library that is part of a framework that is distributed to everyone, or is part of a custom framework that was added by someone else.

Also, the naming convention tries to avoid namespace collisions by having unique identifiers such as CompanyName. It also reduces any confusion and issues in terms of the source of the new library.

This is not only a Microsoft thing, but in the Java as well. Namespaces in Java, called “packages” has the following convention:

The prefix of a unique package name is
always written in all-lowercase ASCII
letters and should be one of the
top-level domain names, currently com,
edu, gov, mil, net, org, or one of the
English two-letter codes identifying
countries as specified in ISO Standard
3166, 1981.

Subsequent components of the package
name vary according to an
organization’s own internal naming
conventions. Such conventions might
specify that certain directory name
components be division, department,
project, machine, or login names.

So, if I had a super awesome piece of software, it may be in the net.coobird.superawesomesoftware package.

And using package names that contain the default java., javax., com.sun. packages are a big no-no.

Leave a Comment