C# Naming – Should Classes Representing Multiple Values Be Singular or Plural?

cnaming

So we've got the following class:

public class BudgetAmounts
{
    public readonly int BudgetFk;//Foreign key to Budget
    public readonly int ItemSalesGroupFk;//Foreign key to the type of product being budgeted
    public readonly decimal DollarAmount;
    public readonly int UnitAmount;
    ...
}

This class represents a table with the above four columns. There is no relation between DollarAmount and UnitAmount – the two values are entirely independent.

I pointed out in a code review that classes should be named as singular – 'BudgetAmount'. Otherwise, you'd have things like:

var amountses = new List<BudgetAmounts>();

However, it was pointed out that since there are two amounts (dollar and unit) in the class, it doesn't make sense to name it as singular.

What is the best way to proceed?

Best Answer

After reviewing the comments from John Wu and candied_orange with my Team, we've agreed that the best approach would be to redesign what the thing is so as to make it singular. Calling it (both in code and database) 'BudgetLine' instead of 'BudgetAmounts'.

Related Topic