Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why namespace types should not depend on nested namespaces types?

Tags:

namespaces

c#

In .Net naming guidelines (http://msdn.microsoft.com/en-us/library/893ke618(v=vs.71).aspx) there is this statement:

"A nested namespace should have a dependency on types in the containing namespace. For example, the classes in the System.Web.UI.Design depend on the classes in System.Web.UI. However, the classes in System.Web.UI do not depend on the classes in System.Web.UI.Design."

I would like to know: why?

like image 383
bcsanches Avatar asked Jul 13 '12 01:07

bcsanches


1 Answers

Because it makes sense when you think about it.

Let me explain with a small example:

A knife-blade for example needs a handle for it to be a "knife".

But a handle doesn't need a knife-blade to be a handle, correct?

using KitchenSet;
using KitchenSet.Knives; // This is where your knives (what uses Blades) would live.
using KitchenSet.Knives.Blades; // The actual blades. 
like image 80
Only Bolivian Here Avatar answered Nov 10 '22 10:11

Only Bolivian Here