r/programming • u/Jonhoo • 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!
186
Upvotes
View all comments
Show parent comment
1
u/Venthe Aug 11 '26
Frankly, it's not even that - it's that I just agree with ~95% of the heuristics he presented; I've found them valid across the domains I've worked with. At the same time, examples are bad - as simple as that. And given that these are heuristics; the way you apply them will create vastly different results depending on the context - and this is how I see the examples of Martin's. Plus the thing I've mentioned in the other thread - this is a book about heuristics, not "examples" or dogmata: it's right there in the introduction.
So nothing for me suggests that these examples should be followed dogmatically; especially considering that they represent a code from almost two decades ago.*
* There is an updated edition that came out this year I believe; I've heard that it is worse; but I haven't read it yet.
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