Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

We have about 3/4 different projects, each sharing a certain level of data. Some data is not shared, but all the data access has ended up in a single namespace that is included in every project.

Utility methods and other "shared functionality" is continually added to this root namespace, and is ultimately fairly organized, but it all ends up in a single dll to be included in projects.

To me it seems overly centralized but does it qualify to labeled a God Namespace? (does that term even make sense?)

share|improve this question
    
There is no difference between a global variable and a variable in a namespace if nothing exists outside of that namespace. –  stonemetal Feb 15 '12 at 20:17

2 Answers 2

I don't think that there is single yes or no question, but anything that ends up being "God" is not a good sign. You don't provide any details about the language that you are using, but IMHO putting everything in a single namespace is as bad as using namespace std is in C++. In general you should try to avoid namespace pollution. You can find some more arguments about the pros/cons of single/multiple namespaces on c2.com

share|improve this answer

I would say it's definitely not as bad as a God Object or Super Object. Those are a whole different animal that is hard to write, maintain, debug, and test and they should be avoided at all costs.

As far as the namespace goes, that's definitely a legitimate concern, and if you are finally getting to the point where your namespace is becoming overcrowded I don't see a problem with splitting it up across a boundary that makes sense.

So, to answer the question in your title: no

Should you add additional namespaces? only if it makes writing and maintaining code easier.

This answer is somewhat generic, but I'm not sure I can be much more help without more details.

share|improve this answer
1  
+1 We use a '<Company>.Enterprise' namespace for our shared items. It's currently broken up into 7 or 8 dlls based on function. –  DaveE Feb 15 '12 at 19:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.