3 ms·
I find the argument not very strong. While stating that comments will become outdated, the author also states that he uses comments for code organization. There
by newscracker 10y ago
I find the argument not very strong. While stating that comments will become outdated, the author also states that he uses comments for code organization. There's nothing inherent about code organization comments that would somehow make them less likely to become outdated or not used at all (header styles wouldn't be prevented from going under some other comment heading by default, to take the example the author stated).
I write comments for a few different reasons, the most important being to document my thought process at the time of coding and to note other approaches that failed or why it's done in a specific way. This helps the coding process itself.
Focusing on the what and why makes it easy to skim through code that someone else (including one's past self from several months ago) wrote. While good naming could help to some extent, there is no substitute to longer comments to capture thoughts and assumptions that could be revisited in the future to learn from as well as identify opportunities for improvement.