News for hackers. Stuff that matters.
Re:Best practices for writing code comments by ijidak on Friday December 24, 2021 @05:02PM (#29678199)
Hard disagree with this.

Yes, code should be easy to understand.

But well-written comments that explain assumptions and intent helps as code evolves over time.

Also, comments are quicker to scan than code itself.

A good comment can indicate code that can be ignored for the purposes of certain troubleshooting.

Finally, junior developers usually write code that is difficult to understand and don't comment.

I've rarely ever seen a junior developer that both writes unreadable code and takes the time to write comments.

Usually comments are a sign of seniority, someone who has pity on those who will come after him/her.

And thus that person tends to also write understandable code.

Perhaps there's an uncanny valley in between where comments are a band-aid for complexity, but I have never observed that in years of working with many developers.

There are no comments on this comment yet.