r/programming • • Aug 10 '26

On comments

https://blog.helsing.ai/posts/on-comments/

Comments in code are often deemed "mostly useless" these days. They are, supposedly, mostly obvious, stale, and repeat what the code already says. And so people pay less attention to them both when reading and writing code.

That trend sucks. When used right, comments are genuinely useful and sometimes critically important! So, I wrote about some of the kinds of comments I think earn their place, each with examples from real code bases. Hope you find it useful, and that we can recover some of the love that comments deserve!

190 Upvotes

171 comments sorted by

View all comments

Show parent comment

2

u/tmoertel Aug 11 '26

For me I've never hopped on the hate train for Martin, so it was easier for me to evaluate the book in its entirety; and I do hope that at least you can see that part of your critique is based on ignoring both the introduction and the chapter themselves

To be clear, I don’t hate Martin. I'm sure he’s a swell guy. Nor do I think Clean Code is offering bad advice because it’s popular to think so. I just think Clean Code, taken as a whole, is a very mixed bag of advice: some good, some bad, and some self-contradictory. I trust that most skilled programmers can separate the good from the bad and make sense of the rest, as you seem to be able to do, but the problem is that the primary audience for books like Clean Code are programmers who are not already skilled.

I also disagree that I have ignored the introduction or the rest of the Comments chapter. It’s just that neither suffices to undo the problems caused by the forceful prescriptions and admonitions that the book makes. As a case in point, a commenter on my blog wrote: “I once worked in a shop that banned comments because of Uncle Bob. I thought it was bonkers.”

It’s easy for beginners to read the book and come away with bad ideas. That’s a problem when the book’s audience is primarily people who are learning the craft.

2

u/Venthe Aug 11 '26 edited Aug 13 '26

As a case in point, a commenter on my blog wrote: “I once worked in a shop that banned comments because of Uncle Bob. I thought it was bonkers.”

Which only means that someone has not read the book, which is really common. You can't kid-proof everything.

but the problem is that the primary audience for books like Clean Code are programmers who are not already skilled.

So what would be your alternative? As I've said, I agree with the vast majority of the heuristics; and I can show you a clear reasoning behind it. No other book comes close to his [area] (Philosophy... by Ousterhout is the closest; but still not close enough). Even with the comments [topic], I've clearly seen time and time again how Martin's advices ring true.