Reputation: 53313
Are there any commonly accepted guidelines for usage and organization of namespaces in big projects?
Thanks!
Upvotes: 1
Views: 442
Reputation: 34218
MIcrosoft's guidance is CompanyName.TechnologyName[.Feature][.Design]
.
Upvotes: 4
Reputation: 2528
..
E.g. if your companys name is Sample Software Solutions and you were writing an ATM system then you might have assemblies like:
We would then typically have some unit test assemblies:
And there may also be one or two IT or AT assemblies (Integration / Acceptance testing) e.g.
Upvotes: 0
Reputation: 3800
Namespaces are mainly just about avoiding Ambiguity with other classes/Objects. And in terms of organization I like to organize UI elements away from other working Function;
tip: To make sure your code is never confused with other objects use a reverse order of a domain name that may be registered for the product.
com.somecompany.app.*
com.somecompany.Math;
Math.work(a,b)
com.somecompany.UI;
UI.SomeUserControl
UI.AnotherUserControl
UI.Forms;
com.somecompany.Web;
Upvotes: 0
Reputation: 3532
You can try FxCop, there are some rules.
Generally you can make some base prefix (company)
Then add the tiers/modules of the project (DAL, UI, Common, etc)
Then I add folder names to the namespace.
So if my file with MegaUtil class is in prj Common in folder Utils/Misc it will be:
YourCompanyName.Common.Utils.Misc
Upvotes: 2