For example, is this a good practice?
private SalesOrder salesOrder;
public SalesOrder SalesOrder
{
get { return salesOrder; }
set { salesOrder = value; }
}
Or should I always append the object property with Object or BusinessObject to distinguish the property type from the property itself:
public SalesOrder SalesOrderBusinessObject
{
get { return salesOrder; }
set { salesOrder = value; }
}
Does it matter if the property is part of a web page or an object?
The latter is horrible. It’s modelling something that has a sales order, which in turn is modelled by an object – not modelling something that has a sales order object.
“BusinessObject” should only be the name of something in your code, if you’re writing a tool for developers to help them deal with business objects.
The former is often good.
It’s not good if there could be more than one
SalesOrder– even if one is the “main” one, you’re introducing confusion. However aSalesOrdersproperty that was an enumerable or collection ofSalesOrderobjects is good (when the English-language plural isn’t of the singular + ‘s’ form, use the real plural rather than just adding s, unless it’s a case where the English plural is the same as the singular.It’s less than great when everything else is sales-related. E.g. this is horrible:
In this case I’d cut the “Sales” from each property name, but not (necessarily) from the class names.
However, this is a case where it’s nicer:
In all, the way to approach it is:
If they end up giving the same name in a particular case, then that’s fine (unless it’s a nested class, when it’s ambiguous and illegal). If they end up giving a different name, then fine too.