Namespace guidelines

  • Thread starter Thread starter K-Dub
  • Start date Start date
K

K-Dub

I have read the MS docs on namespacing but I am still a little unclear.

Should I use:

Acme.Web.OrderFullfillment
Acme.OrderFullfillment.Data

OR

Acme.OrderFullfillment.Web
Acme.OrderFullfillment.Data

The latter seems right but are dependencies across sibling namespace okay??

Also, what are people using for Business layer classes?
Acme.OrderFullfillment

OR more something like

Acme.OrderFullfillment.BAL
 
C# is like Java: every namespace is independent of every other
namespace. The compiler and the .NET Framework do not recognize any
special relationship between

Acme.OrderFulfillment.Web
and
Acme.OrderFulfillment.Data

or between either of these and

Acme.OrderFulfillment

Therefore, namespaces become simply a handy categorization tool. You
can call a namespace anything you like. The commonly-used "." notation
and the hierarchical-looking names are just to help you organize your
code. They have no effect on the compiler or the runtime.

And yes, dependencies between namespaces are OK. The only thing you
can't do in .NET is have mutual references between two assemblies.
Mutual references between two namespaces are fine, so long as both
namespaces are in the same assembly.
 
Hi,

I'd adopt the following schema:

Acme.OrderFullfillment.Web
Acme.OrderFullfillment.Data
Acme.OrderFullfillment.BAL

This way, it is in accordance with Microsoft recommendations on building
namespace names (<Company>.<Product>.<Subsystem>).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top