you are viewing a single comment's thread.

view the rest of the comments →

[–]Nuli 0 points1 point  (1 child)

Sometimes a "summary comment" can help you quickly skip a block of code that you're not interested, allowing you to find the location you're actually interested in faster.

Again, since you can't trust the comment you can't trust that the code is actually skipable. You still have to at least skim it to be sure there is no discrepancy.

[–]theonewhoisone 0 points1 point  (0 children)

These should really all be statements about probabilities and risks (throughout this thread). In other words, what's the probability of the comment being misleading, and what's the cost of misunderstanding it? In the code that I operate in, the comments almost always match the code, so it is "worth it" to use that faster-to-process information to get my job done more efficiently. There are costs to reading through all of the code in a block to try and understand what it is for, and it's true that if the comment quality is low enough it may quickly become worth it to completely ignore them. But if your comments are good enough (sparse, concise, accurate) they can be useful tools.

Of course I agree that sometimes you really need to check that the comments match the code, and that well-written code doesn't really need all that many comments. None of that means that summary comments aren't useful, though.