getters and setters are kind of holy cow. But if almost all do nothing but set or get a value, why not directly access the attribute?
Yes, I know the all-customers-directly-taking-money-from-the-bank-safe argument, but if the bank clerk blindly does what the customers want, she's superfluous and the customer might as well take money from the safe himself. Same goes for setters like
public void setXX(XX xx)
{
this.xx = xx;
}
But if a setter really does something useful, it indeed should be a distinct method and not a C# like setter. |