I'm in the middle of a debate here at work. Say you have a POCO named Person
. Person
has an identifier. I'm in the camp that says the identifier should be named Id
.
class Person
{
public int Id { get; set; }
}
The other camp says it should be named PersonId
.
class Person
{
public int PersonId { get; set; }
}
Is one more correct than the other?
I think that using Id
is more readable and definitely less code to type.
The argument against Id
is that it may be confusing because someone may not know if the ID belongs to a Person
or an Address
. I think that argument falls flat if you just name your variables descriptively.