Eliminate comments?

While I was at the NFJS Symposium I heard from a number of speakers stories about how they were bit by inaccurate comments to the point that they now use comments sparingly. As one may be able to tell from my other postings, this goes contrary to eveything that I believe in. To me, comments are a training issue. If developers are trained effectively so that comments and code are really one in the same then there’s never a problem of having comments be out of date. But given that comments cannot be checked for accuracy, there’s always the possibility of a refactoring (especially one done automatically though an IDE) that produces inaccurate comments. Does this mean that comments should be eradicated? No. It simply means that more diligence is needed. For example, before an automatic refactoring is checked in, each change should be checked for accuracy. This is good practice in any case since there is always the possibility that the refactoring had implications that were not initially understood. But how many developers do that? Again, solved by training.


One comment

  1. Pingback: More on Code Comments « rgrzywinski

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s