Wednesday, March 26, 2008
At work I am one of the ~4 code reviewers on the team.  In this position, I come across code that makes me scratch my head from time to time.  For one reason or another a developer chooses interesting logic (I've done it plenty of times too, I still do; nobody's perfect.)

Today, I came across this in a custom UserControl:
public override Visible {
   get { return base.Visible; }
   set { base.Visible = value; }
}
This is such an illustration of a fundamental lack of understanding that it's almost elegant.  In this case, it was probably due to a very tight schedule and happened to get overlooked.

If you can't spot the WTF, and you're a developer, you should get yourself one of those "Learn to Program in 21 Days" books.  You'll also want to consider crying yourself to sleep.

posted on Wednesday, March 26, 2008 7:39:22 PM (Eastern Standard Time, UTC-05:00)  #    Comments [3]
Related posts:
Large switch statements
Time-out interval must be less than 2^32-2
But that's all you have to do!
Thursday, March 27, 2008 3:48:21 PM (Eastern Standard Time, UTC-05:00)
Right On!
Me
Monday, April 14, 2008 12:24:46 PM (Eastern Standard Time, UTC-05:00)
Was this me? ;)
JC
Wednesday, May 07, 2008 10:03:54 PM (Eastern Standard Time, UTC-05:00)
umm.. I believe that's what's known as a 'pass-through property'. You should look it up, I think it's in the GOF book..

Seriously though, that'd make a great "what's wrong with this code" technical question in an interview. You should ask it before the interviewee sits down so you can send them on their way quicker if they say "uuh, what's base mean?" or "well, for one, Visible should be lower case."
Comments are closed.