I was taught in university to write comments for our programs. As I write comments, I feel like I have a better organization and understand the programs better.
However, I am in a company where most of the code I encounter doesn't have comments. Why would a programmer not write comments? Are there are any objective reasons? Do you think comments are annoying when you read others' code? I don't write comments either, and I can think of some reasons why not:
- Because I can already easily understand the program.
- My boss won't care how my program gets the job done.
- Nobody is likely to pick up my program after I am gone.
The purpose of comments is usually to include explanations for the program, however, I found that in my company, comments are used to cover obsolete code instead. For example:
/* Obsolete code */ New code
What is your opinion on commenting? Should we do it? Or does it depend on the situation?