I'm wondering what guidelines you guys are using for determining the structure for your Namespaces. When do you decide something warrants it's own Namespace?
I read in a forum discussion or article that a best practice is to go for a shallow tree with as few child Namespaces as possible but can't remember the reasoning behind it or the link.
Now I'm just doing what 'feels right' but would prefer some more concrete guidelines especially to explain to newer developers.
Thanks.
Microsoft has guidelines on namespace naming, here too.. Brad Abrams has his thoughts.
I go for the shallow tree approach, myself. One of the negative consequences of many-layered namespaces is the proliferation of same-named and same-functioned classes within a single project (differentiated only by their different namespace locations), or even worse: same-named and differently-functioned classes in the same project. Having only a single namespace in a project forces developers to give each separate class a good, self-descriptive name.
Having multiple folders in a project is still a good idea, however (for organizational purposes), and I wish there was an option in Visual Studio such that classes added inside a sub-folder can not automatically have the folder names added to their namespaces (there may be such an option in the versions newer than 2005). I work around this by always adding new classes at the root level and then dragging them into their appropriate folders.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With