re: The Importance of Quality Comments VIEW POST


In my experience, even well-written code can be improved by comments and I'm pretty sure that if the code is well-written the comments will be where they should be and provide the information they should provide. And you are absolutely right, a bad comment can be a nightmare.

I spent a lot of time trying to figure out why we were using a custom library to find out that I was looking at the wrong library.

Of course, that teaching people to write better is a lot better, but that's something for another post.

Your personal experience with bad comments is exactly why I use comments only as a last resort. Once I write a comment I try to think of how I can express my intent in code with out the comment and look at ways to remove them through refactoring. With modern refactoring tools it is pretty easy to extract a method and name it with the comment you just wrote. So why not encourage that instead of writing comments that can easily go out sync or move and mislead people and waste time because the comment was wrong?

code of conduct - report abuse