namespace design help

  • Thread starter Thread starter Ian
  • Start date Start date
I

Ian

Hi there,

I am designing a application that has many different parts to it i.e.
Database read and write, Encryption classes, printing functionality. etc etc

I have created a standard namespace i.e. mycompanyname.myapplication

Is it better to then create a new name space for database and encryption
parts i.e.

mycompanyname.myapplication.encryption
mycompanyname.myapplication.database

or is it better to stick everything in one name space??

I am also thinking about designing some seperate dll's (modules) for the
app, what naming convention should i use for the name space here i.e. just
mycompanyname.myapplication or drop down to

mycompanyname.myapplication.mydllFunctionality

Any help or guidance would be gratefully appreciated

Thanks

Ian
 
Our company purchased a component where they use a lot of namespaces, it's a
real pain to have to set up 5-10 using statements just to get basic things
to work. This is an example of namespace overkill.

Think about how the classes in each namespace will be used. Will the code
always use classes from both, combine them, if they are used one at a time,
seperate them.

At the end it boils down to personal preference.

Chris
 
If the technologies are distinct then a different namespace is a good idea.
If the encryption is supposed to be used with the database then it would be
a good idea to put them together. If the end-developer can use the
encryption separately then different namespaces might work well there. But,
like Chris said in his reply, too many namespaces can be annoying as well.
This question is somewhat complicated to answer because it would need to be
a combination of "what does the type do?" and "how are these types
related?". Separate dll's can also be a good or bad thing depending on how
they're used. Splitting them would give you an opportunity to distribute
them separately if you wanted to, and it would also give the end-developer
some freedom in a size-limited environment. One giant, size-wise, dll might
be equally as annoying as having to manually set a reference to multiple
dll's inside a project. Whatever seems right in your situation... then go
with that. I've included some links below that may or may not help in your
decision making. They point to Microsoft's guidelines when it comes to
naming and class library design.

Microsoft's namespace naming guidelines.
http://msdn.microsoft.com/library/d...enref/html/cpconnamespacenamingguidelines.asp

Microsoft's design guidelines for class library developers.
http://msdn.microsoft.com/library/d...ef/html/cpconnetframeworkdesignguidelines.asp
 
Back
Top