Redundant Property
October 30, 2012
There’s some real incompetence on my current team. WTF would anyone add this code and check it in:
public class BizObject
{
#region private fields
private Boolean _liveBid;
#endregion
// More properties here...
public bool LiveBid {
get { return State == AuctionState.SaleActive; }
set { _liveBid = value; }
}
}
Makes no fucking sense.
This developer added a new property to the class, with a setter that sets a private field which is never used. So setting the value doesn’t error, but the getter uses a completely different mechanism for determining what to return.
This could almost (but not quite) be forgiven if this screw up happened as part of the refactoring process, but both the new property and backing field were added in the same fucking checkin.
If the setter is irrelevant, remove it. Why there’s a need to leave redundant or shitty code sitting around is beyond me. Everything is source controlled.
Disaster waiting to happen.
Resolution:
1) Get a job at a company you hate less / you feel more respect for your peers.
2) Get on with the rest of your life.