3 ms·
Worst. Advice. Ever. Please comment your code. First, you're probably not going to immediately remember what the code does 6 - 12 months after you write it and
by russelluresti 13y ago
Worst. Advice. Ever.
Please comment your code. First, you're probably not going to immediately remember what the code does 6 - 12 months after you write it and when you have to come back to it for an update it's going to take you too long to figure out if you actually read the code. Comments make familiarizing yourself with your old code much faster. Second, any other teammate who touches the code is going to hate you if they have to read your code to figure out what it does. There is nothing worse than looking over code written by someone else when there are no comments.
- dkuntz2 13y agoI disagree. And I'm not sure you caught the tiny part at the beginning when the author talked about how why comments are good, but what and how comments are mostly useless. Yes, there was only a tiny mention in the post, but it was there. I think that what and how comments are useless because they're literally the code itself. Comments like 'increment by two' are useless, because the next line literally says `x += 2`. If that comment was expanded to be something like 'increment by two because ...', explaining why x is being incremented by two, it becomes useful, and I think the author agrees. I think the reason these posts get as much traction as they do every time they're posted is because people tend to write bad comments. In my experience as a CS tutor at my college, most new programmers either write useless what/how comments or no comments at all. The problem I see with these posts are that they don't talk about how there are good kinds of comments, but that everyone should just make their code cleaner and everything will be great. If more time was spent talking about how to write better, more informative, and relevant comments I'd like these posts more.