In a framework, should class dependencies run down a namespace (root to leaf) or up a namespace (think of it as an inverted tree with the root at the top)?
I'm having a hard time describing this, so let's look at an example:
namespace foo
{
class snafu : fubar {}
}
namespace foo.bar
{
class tarfu : snafu {}
class fubar {}
}
In this case, class tarfu
has a base class dependency on snafu
. The dependency walks up the namespace tree. Class snafu
has a base class dependency on fubar
. The dependency walks down the namespace tree.
Should dependencies only walk up the namespace tree? Or should it be the reverse? Why should it matter?
I'm developing in .NET, but if its different for other platforms I'd be interested in learning about those as well.