Organizing classes into namespaces

Are there any principles for organizing classes in namespaces?

For example, is it normal if classes from the namespace N depend on classes from NX? And if classes from NX depend on classes from N?

+4
source share
2 answers

In general, this should be good for your example if your packages were "N.UI" and "N.Util". I have seen namespaces used in two common models:

1) All levels of the system have a namespace (i.e. database, network, business, etc.)
2) Each component has a namespace (i.e. Client, invoice) and multi-level names located under

In either case, the subspace namespaces will be bundled packages in a larger namespace, so it would be great if the user interface depended on your domain objects.

However, although it would be normal for NX classes to rely on classes from N, I don’t think that for classes from N it would be reasonable to depend on classes from NX - it looks like you could use some reorganization in this case.

+5
source

The ibx NX classes can rely on classes in N. But the classification in N should not rely on classes in NX, which is a bad design.

Some namespace rules: http://msdn.microsoft.com/en-us/library/893ke618.aspx

+2
source

Source: https://habr.com/ru/post/1277274/


All Articles