For those of you out there writing reusable components, what do you consider to be best practice if you're extending the functionality of the .NET framework?
For example, I'm creating a Pop3 library at the moment as one doesn't exist in .NET. Do I create a custom namespace or do I use System.Net.Mail
?
Best Answer
From the Namespace Naming Guidelines:
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 also in Java. Namespaces in Java, called "packages" have the following convention:
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.