organising classes and namespaces

prowla2003

Newcomer
Joined
Jun 18, 2003
Messages
10
any ideas on this... i've got a web application and was thinking of having namespaces like...

companyname.datamanager
companyname.booking
companyname.vehicle

these would also be the class names or very similar to...

there are a many examples with namespaces such as

companyname.datatier.booking
companyname.datatier.vehicle

i dont see the point in this... maybe there is when you have bigger applications than we have... or if you ever intend to split the different tiers on to different machines.. which i dont ever see happening

any data managing happens in the datamanager class/namespace

do i really need to split the namespaces the "Microsoft" way??

are there any other good reasons or articles people know of on how to organise things?
 
Namespaces were mainly made so there was no conflicts with the names of the object. But they provide great organization too, for example lets say you dont know the name of some class but you know it should be in System.IO becuase it does something with a file, you look through that namespace instead of all 3500 classess. You dont really need them for small projects, but iff it gets bigger it can be a lot of help.
 
ok so would you be suggesting not to use namespaces at all?

or just a companyname namespace?

the basic object model we got is about 10 classes each will inherit from DataManager..

i can see that it doesn't really help "the organisation" of the classes to split that up into namespaces and i cant see us having huge numbers of classes in the future

does anyone think different - just trying to get other peoples ideas on how anyone else has put together solutions
 
For small projects it's common to just place everything in one namespace, the name of the company or even the name of the product.
 
If there are only a few classes (maybe up to 15 or so), and you can stick them all in one namespace, then do that. If the classes start getting confusing, then start splitting them up.

For example, if you have written some Socket wrapper and helper classes for your project, you might consider putting those in the namespace "MyCompany.Sockets" and you might want to put data object classes in "MyCompany.DataObjects".

You organize it how you are comfortable with it; there's no required way to do it.
 
Back
Top