Hacker News new | ask | show | jobs
by nostrademons 5655 days ago
"Why" comments are often quite useful, but the example in the article was filled with "What" comments, and doesn't seem to be talking about that at all. "Why" comments are often infrequent enough that there's nothing wrong with putting them inline with the code.
1 comments

I agree that "Why" comments are infrequent, but they are still important. I work in the scientific computing field and here "whys" are they key to understanding code. But lengthy explanations of why certain steps of the algorithm are needed, are very distracting. Such a scenario calls for a separation of code from comments.