6

English in not my native language, therefore it is a little more difficult to pick a good name for a namespace. Are there any best practices, conventions or rules I should adhere to?

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?

Comments are most welcome!

(There are many questions about good class names, but this question is about namespaces!)

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

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Kees C. Bakker
  • 32,294
  • 27
  • 115
  • 203

4 Answers4

10

Follow Microsoft guidelines:

http://msdn.microsoft.com/en-us/library/ms229026.aspx

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

Saeed Neamati
  • 35,341
  • 41
  • 136
  • 188
  • All good and well.. but it doesn't say anything about the way a Subnamespace is named. 'Configuration' is a better namespace than 'Configurable'. Any ideas about linguistics? – Kees C. Bakker Nov 25 '11 at 12:28
  • Yeah, still you can see other guidelines [here](http://msdn.microsoft.com/en-us/library/ms229045.aspx). – Saeed Neamati Nov 25 '11 at 12:31
0

Use namespaces to group your classes in a logical way. If your classes are al about organizational stuff, than yes, this is a good namespace. BUT, I think your classes should be grouped more to the shared purpose they have. So, if you have a bunch of controllers...ad them to the CFW.CoreSystem.Controllers namespace for example.

Bas Slagter
  • 9,831
  • 7
  • 47
  • 78
0

In our company every namespace starts with the company name, after that the program, so they look like:

Company.Program.BL.Something;
Fischermaen
  • 12,238
  • 2
  • 39
  • 56
0

MSDN article - .Net Framework Naming Pattern and Guidelines.

A consistent naming pattern is one of the most important elements of predictability and discoverability in a managed class library. Widespread use and understanding of these naming guidelines should eliminate many of the most common user questions. This topic provides naming guidelines for the .NET Framework types. For each type, you should also take note of some general rules with respect to capitalization styles, case sensitivity and word choice.

KV Prajapati
  • 93,659
  • 19
  • 148
  • 186