views:

65

answers:

3

currently i am discussing if placing entity at the end of each entity is a good practice for example

public class CustomerEntity:BaseEntity{}

instead of

public class Customer:BaseEntity{}

in my career i had seen both, but how do you do it nowadays?

+3  A: 

Which is more important: the fact that it's a customer or the fact that it's an entity? I say leave it off. If you use it like an entity, it will be obvious that it's an entity, regardless of how you name it. But by leaving off "Entity", you focus on the fact that it's a customer.

John Saunders
A: 

The business-related classes in our shop all inherit from a class called (intentionally generically) DomainObject. None of the inherited classes contain "Object" as part of their name--that would be superfluous--we just name them appropriate to their function.

Jim H.
+1  A: 

There are two conflicting bits of advice here, in my opinion. One is to use the simplest name possible, the other is to use a naming convention to make the purpose of your objects clearer when they are being used.

Personally, if there is not likely to be any confusion as to what a Customer is, I would leave off the Entity part. If you find yourself in a situation where you could have multiple objects named Entity, then I would leave the one that is likely to be used most named Customer, and create some compound noun for the other (like CustomerOrder, CustomerRequest, etc)

ckramer