views:

52

answers:

1

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!

A: 

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.

Pavel Shved
Thank you for the answer, Pavel. Waiting what others will say
Andrew Florko