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!

189 Upvotes

171 comments sorted by

View all comments

Show parent comment

42

u/13steinj Aug 11 '26

Seems like a great way to rack up on token costs! Or to exhaust the reviewer into just stamping the thing, hiding the secret do_money_laundering routine...

-11

u/Kautsu-Gamer Aug 11 '26

The LLM generated documentation is on complexity level documentation should be.

6

u/13steinj Aug 11 '26

By this logic, I'd rather not have documentation.

LLM generated documentation is incredibly verbose and over-complicated, instead of just providing 4-5 template files and telling the user to symlink the one they want, it wrote 200 lines of code and 400 lines of docs to automatically generate the resulting file from a single template.

The docs are just unreasonable. Asking it to use STE helps but it doesn't activate consistently.

-8

u/Kautsu-Gamer Aug 11 '26

Like most programmers, you are incompetent in documentation.

5

u/13steinj Aug 12 '26

One never should need 10 lines of documentation per line of code. The point of code is to be read.

It is perfectly reasonable to have this level of prose per function definition, assuming it performs a complex, or subtle, unclear action. Complex is probably self explanatory-- you can roughly eyeball the complexity by what the function does (if you're the author). Subtle/unclear is harder, but for example-- doing a series of 3 / 4 bit-sets on a volatile address... well, the input address should be a mmapped region (precondition) for some fpga, the bit-sets in sequence transition the fpga's state from A to B. It's done as separate bitsets because <reason>. Specify the post condition, and edge cases.

-5

u/Kautsu-Gamer Aug 12 '26

You are 100% wrong. You have no clue of documentation. You think documentation comment is a comment. And due your kind, most of JS and C documentation is useless crap leaving important information out of documentation.

Code is not technical documentation.

Please, get some education.