Abstract
Which name is better?
Domain.PersonService
DomainServices.PersonService
DomainServices.PersonDomainService
(consider some longer names likePersonDomainServiceModelDecorator
)
or something else?
Situation
We have a framework in which there are some base classes for each layer. Ex. Repository, Domain Services, UI, etc.
Each logical layer has a name which is used as its namespace:
- "Data" for data layer that contains repositories; Ex.
Fx.Data.DbContextRepository
- "Services" for domain (not web) service layer; Ex.
Fx.Services.CrudService
- "Web.UI" for Web UI layer; Ex.
Fx.Web.UI.Controllers.CrudController
We also follow the same rule for end-projects whith some extra layers:
- "Data" Ex.
Project.Data.PersonRepository
- "Services" Ex.
Project.Services.PersonService
- "Web.UI" Ex.
Project.Web.UI.Controllers.PersonController
- "Entities" for code-first entities; Ex.
Entities.Person
- "Models" for object models; Ex. Models.Person.Criteria,
Models.Person.PersonDeleteModel
My focus is on "Domain Service" layer but any ideas about other layers are also welcomed.
We've finally come to the conclusion that "Services" is not a suitable name for "Domain Services" as it may cause ambiguity between a "Web Service" or "Domain Service" layer.
Now we are changing the "Services" namespace to "Domain" or "DomainServices". But we have another problem. We put a "Service" suffix for every domain service class (Ex. PersonService
). Now it seems ugly to have "DomainService" suffix (Ex. DomainServices.PersonDomainServer
or DomainServices.DomainPersonService
).
So it can be prettier to use "Domain" as namespace while class names show that they're services under domain namespace (Ex. Domain.PersonService
).