Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Redundancy helps to spot errors. When I see code like

// add vertical scroll bar

addHorizontalScrollBar(...)

I _know_ something is wrong.

Did the comment get out of synch with the code? Or the developer copied-and-pasted the wrong function? Or the function itself is misnamed? I don't know! Let's investigate... and fix whatever happens to be erroneous!

But when I see just

addHorizontalScrollBar(...)

all I know is that a horizontal bar seems to be added (provided the function name reflects its... er... function). I don't know whether it was intended behaviour. If it has not been, nothing indicates this at all.

I've actually caught real bugs this way, multiple times.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: