4

What are the naming conventions you use for application domain model classes and presentation layer classes? Postfixes/Prefixes to distinguish the aim of the class from the first sight:

For example information about the person that is returned from DAL can be

public class PersonEntity 
{
  public Guid Id { get; set; }
  public SexType Sex { get; set; }
  public Date Birthdate { get; set; }
  public string Name { get; set; }
  public string Family { get; set; }
  public string Patronymic { get; set; }
  ...
}

or may be you prefer PersonData or PersonInfo or something more appropriate?

Than I use databinding to create appropriate presentation. For example SexType should be converted to localized string (Male, Mann, Homme, Hombre, ...) Birthdate to appropriate date format (YYYY.MM.DD, DD.MM.YYYY, ...) and full name into -> Family N.P.

So I use another layer of classes for presentation databindings. Something like

public class PersonDecorator
{
  public string Sex { get; set; }
  public string Date { get; set; }
  public string FullName { get; set; }
}

or may it's better to name such class PersonPresenter, or PersonView, or something more appropriate?

Thank you in advance!

1 Answer 1

3

The EntityPurpose convention for class names works just fine in a lot of places, especially if you have several entities (Persons, Cars, etc) and several layers (Model, View, Action, etc).

I'd name your class PersonPresentation.

1
  • Thank you for the answer, Pavel. Waiting what others will say Aug 2, 2010 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.