Search This Blog


Name Convention for Object Oriented Apps

Some time ago I came across with a question about naming conventions for different parts of the software: UI, Service, Entities, etc. I decided to share some of the conventions I have been using.

Naming Convention: ( Most used ):

Entities: As it is part of the domain package, no prefixes or suffixes here: Ex: Car, Client, etc.

Repository: Usually a suffix Repository. Ex: ClientRepository, CarRepository, etc.

ValueObject: Value objects are part of the domain so it follows entity´s convention. Ex: Money, Address, etc.

DTO: Usually a suffix DTO. Ex: ClientRegistrationDTO, CarRentDTO, AddressDTO, etc.

Service: Usually a suffix Service. Ex: ClientRegistrationService, CarRentService, etc.

Namespace Convention: (My Suggestion)

Entities, ValueObjects, Repositories Interfaces, Domain Services (Domain Layer)
Ex: Acme.Finantial.Domain.Debt,

Application Services 
Ex: Acme.Sales.Service.ClientRegistrationService

Presentation Layer
Ex: Acme.HR.Presentation.IClientRegistrationView, Acme.HR.Presentation.WebClientRegistration

Persistence Layer
Ex: Acme.Core.Persistence.PersonRepositoryImpl (<--- implementation in NH, for example)
Post a Comment