What is the best practice for naming properties that are objects?

For example, is this a good practice?

private SalesOrder salesOrder;

public SalesOrder SalesOrder
{
    get { return salesOrder; }
    set { salesOrder = value; }
}

Or should I always add an object property to Object or BusinessObject in order to distinguish the type of the property 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 object?

+5
source share
2 answers

The last is terrible. It models what it has a sales order, which, in turn, is modeled by an object, rather than simulating something that has a customer order object.

"BusinessObject" should only be the name of something in your code if you are writing a tool for developers to help them deal with business objects.

The first is often good.

, SalesOrder - "", . SalesOrders, SalesOrder, ( +), , s, , .

, , . . :

public class Sale
{
  public SalesOrder SalesOrder{get;set;}
  public SalesReference SalesReference{get;set;}
  public decimal SalesValue{get;set;}
  public string SalesCurrency{get;set;}
}

"" , () .

, :

public class Sale
{
  public SalesOrder SalesOrder{get;set;}
  public StockOrder StockOrder{get;set;}
}

, :

  • , , (, , "", "-", "" , ).
  • , .

, ( , ). , .

+2

. , , , , . ASP, "tbl" "vw". , , , . . , , , , , , .

+1

All Articles