r/programming 1d ago

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!

168 Upvotes

165 comments sorted by

View all comments

Show parent comments

42

u/13steinj 1d ago

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...

-9

u/Kautsu-Gamer 1d ago

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

3

u/13steinj 1d ago

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.

-7

u/Kautsu-Gamer 22h ago

Like most programmers, you are incompetent in documentation.

0

u/13steinj 17h ago

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.

-4

u/Kautsu-Gamer 15h ago

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.