Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple namespaces in a single project

I find that sometimes I have the need to have multiple namespaces in a project I'm working on - are there any problems that may arise from having multiple namespaces in the same project?
The alternative is obviously having multiple projects (per namespace) in the Solution.

like image 839
Acidic Avatar asked Mar 03 '13 01:03

Acidic


2 Answers

Yes, it's fine. Often my namespaces align to the folder structure of the project. So the top-level namespace might be the same for the whole project, but there would be multiple sub-namespaces.

The purposes of namespaces are (1) organization and (2) avoiding naming collisions, not necessarily in that order. Whereas, separating things into multiple projects is more because you want multiple binaries or you want to share code between multiple solutions. These are somewhat orthogonal concerns.

like image 93
Tim Goodman Avatar answered Sep 27 '22 16:09

Tim Goodman


Yes many classes to a single namespace. Many namespaces in a project is totally fine. It is cosmetic.

like image 35
iefpw Avatar answered Sep 27 '22 18:09

iefpw