Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enum type naming conventions in DTO's

I'm creating an application facade in front of my domain model and using dto's for the exchanges between the consumer and the facade.

In order to avoid having to fully qualify my namespaces where I'm mapping between dto's and the domain model, I've suffixed all my dto's with Dto. Ie. CustomerDto, AddressDto etc.

I need to define an enum type as part of my dto's as well and am struggling with whether I should use the Dto suffix on my enum type.

I'm curious what others have done with enum types that reside in their dto's. Any feedback is appreciated.

Thank You

like image 398
Striker Avatar asked Sep 22 '11 20:09

Striker


2 Answers

Assuming you're talking about an enum type when you say "enumeration," I wouldn't suffix it with Dto, since that's not really what it is. For example, I wouldn't say CustomerTypeDto since it's not a DTO representing a customer type. However, it is an enum representing the type for a CustomerDto, so maybe CustomerDtoType would be appropriate.

like image 120
StriplingWarrior Avatar answered Sep 19 '22 18:09

StriplingWarrior


Personally I would just use a seperate namepspace and the same name for the enumeration type. I think it's important keep the two seperate so that the external one is just a use case projection of the model.

like image 28
Preet Sangha Avatar answered Sep 21 '22 18:09

Preet Sangha