Namespace question

S

Steven Blair

Hi, quick question regarding namspaces.

Here is an exmaple of a little project I am working on.

I have a GUI, a Business Layer dll and a Database dll.

What is the best strategy for naming conventions? Should all the assemblies
have the same namespace ?
For example, they all belong to namespace Development (even tho one assembly
is in VB and another c#)

Or should each assembly have a unique name, for exmaple Development.BUSLayer
and Development.DBHelper

Any help on this would be appreciated.
 
S

Shiv Kumar

Namespaces typically contain a "family" of classes or related classes.
Further, even though namespaces can span physical dlls, I wouldn't do that
either. If I were you, I'd have all the layers you mention in one assembly,
unless there is a specific reason (say physically deployed on different
machines) for doing so.

At the end, if you have different assemblies then I suggest using different
namespaces as well.
 
O

Owen Hines

Steven,

I agree with what Shiv has said, but just to expand, yes, unique name spaces
in a hierachy. Just to give you an example (or at least the way I do it (
and anyone can come back on this))
looking at your app, and generalizing I would go something like;

base namespace for the gui
----------------------------
Myapp.Gui

base namespace for the business layer
--------------------------------------
Myapp.Business

base namespace for the Database Layer
-----------------------------------------
Myapp.Database

Any additional namespaces would then expand on the base ones
so for instance within database if you have addition functionality for
errormanagement (for instance)

Myapp.Database.ErrorManagement

I hope this is of some help.

rgrds

Owen
 

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

Top