Dotnet namespace conventions

I usually use this convention:

CompanyName.ApplicationName.Functionality

eg.

Acme.EmailService
Acme.EmailService.Dal
Acme.EmailService.BusinessLogic
Acme.EmailService.BusinessLogic.ErrorHandling

but where I work now, they use:

CompanyName.Functionality.ApplicationName

Acme.EmailService
Acme.Dal.EmailService
Acme.BusinessLogic.EmailService
Acme.BusinessLogic.EmailService.ErrorHandling

The last namespace looks a little strange to me. This is a subfolder of the business project, so by default the folder name is added to the namespace.

I have seen many standards for naming conventions, but no one mentions this issue.

What are the advantages and disadvantages of each approach?

+3
source share
3 answers

Follow the naming guidelines that Microsoft has created:

, , , . , System.Net.Sockets , .

:

<Company>.(<Product>|<Technology>)[.<Feature>][.<Subnamespace>]

, Microsoft.WindowsMobile.DirectX.

, , .

http://msdn.microsoft.com/en-us/library/vstudio/ms229026(v=vs.100).aspx

, BusinessLogic Dal - . ,

Acme.EmailService

/. , ? ( ).

, ? ? 10? ?

+3

-, - / , , (, CompanyName - , ):

CompanyName.DB
CompanyName.Common
CompanyName.Web

...

-, , ClientName.Application.Functionality. , (, , ), , , .

, ;)

EDIT: , ClientName . , :

ClientName.Common
ClientName.Application1
ClientName.Application2

....

+2

, , . , 200 , , , , ( ) .

Think of a Framework, we could use namespaces such as System.Ui.Web, which contains all the associated ui namespaces, instead of our current System.Web.Ui architecture, which groups namespaces by platform / application.

I do not believe that there is an exact truth, I believe that there are habits, and it is very difficult to convince people to change agreements.

+1
source

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


All Articles