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.

One Response to “Redundant Property”

  1. Rachel said

    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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: