Thursday, April 12, 2012

Useless Comments in Code

How many times have you had to review and change code that someone else wrote, and you get frustrated by the lack of comments in the code, making it a frustrating and time consuming task to figure out how the code works and what it does?

Even more frustrating are comments that don't tell us anything. They just waste more of our time, time that we spend reading them, which becomes totally wasted time.

Here I will add actual wasteful comments that I came across while reviewing code. I have changed the names of variables, etc to preserve confidentiality. I believe that the authors of these comments should be provided with a free noose to hang themselves with.

Useless Comments

//BUG#8741, 10-03-00, some logic is required here
err... doesn't the whole code consist of "some logic"??? hello???
//BUG#8760, 10-11-00
This is great! Now all I have to do is go look up that bug... oh wait, we don't have that database anymore... aaargghh!!!
// BUG#8741, 10-03-00, added bool parameter
Oh ok. Its... like.... I blinked my eye... I turned my head... I peed in the toilet...
memcpy(pDest, pSrc, nCount); // copy data
hmm... really?
// If no data is found
if (tempstr.IsEmpty())
duh!