5 ms·
> This way the code stays readable/debuggable by humans. Please take the following as expressed with genuine curiosity: Do you not use an editor with syntax hi
by solatic 26d ago
> This way the code stays readable/debuggable by humans.
Please take the following as expressed with genuine curiosity: Do you not use an editor with syntax highlighting and collapsible comments?
At least on JetBrains you can configure the editor to collapse all comments on open and to have the comments displayed in a low-contrast color. This way, LLMs add a bunch of comments, but it doesn't affect your actual experience in trying to read the code. If you encounter code that seems inexplicable, then and only then would you expand the comment to see if that helps you understand.
- metek 26d agoLLM comments for code are almost unfailingly completely redundant or impenetrably verbose bordering on word salad.
- shunia_huang 26d agoSometimes I try to add comments in a new session and the agent just don't have enough context for it to give a comprehensive sentence with full context on the why, then the agent will just describe what it does. Human comment is in another level to answer the questions mainly like "why do it like this" for the later collaborators or the forget-ed self, so the important blocks live when it is needed and can be eliminated when it does not.
- jodleif 26d agoAlso, the language model might not fully understand the code then add a comment, then the next iteration will treat assumptions in the comment as the truth.
- digitalPhonix 26d agoI think “This way the code stays readable/debuggable by humans” is a proof by example (not that the generated comments are necessarily bad). If the human can read/understand it well enough to comment it, then it is readable by humans.
- watwut 26d ago> If the human can read/understand it well enough to comment it, then it is readable by humans. No, because the one who is writing the comment has context later reader dont. The writer knows what the requirements are, what he was trying to achieve and what he struggled to comprehend. Writer also presumably spent more time trying to understand it then the person coming later should.
- Lutger 26d agoIt is not perfect, but the delta between 'cannot understand what agent wrote' and 'it makes sense to me right now' is already an improvement. That it may not be sufficient, doesn't mean it isn't a necessary condition. Besides, it has always been like this. I sometimes can't even understand some of the things I wrote myself a couple of months ago, because I forgot the context. Good comments and documentation will help you re-acquire the context you need, not completely eliminate it.
- digitalPhonix 25d agoI'm not sure what you're arguing? I'm responding to: >> This way, LLMs add a bunch of comments, but it doesn't affect your actual experience in trying to read the code by saying that at least reading the code and generating comments is forcing some understanding. Is there a disagreement in that? You're saying that it's not (necessarily) enough understanding, which may be true but beside the point.
- watwut 26d agoMisleading and hard to read comments are worst then none at all for readability. If he did what you suggest, he would end up with tons of bad javadoc.
- dolmen 26d agoHiding the code from your view is not the solution. The next developer doing a review will see it. The next agent iteration will see it. If the comment is wrong (even slightly) or redundant, that will help noone.
- arw0n 26d agoNot the OP, my two cents: Comments should be written only when there is (hidden) complexity or external context strictly required. Otherwise it is just easier to read the code. Comments then signal one of two things: a) the following code is really complex and I need to tread carefully, or b) this code is complicated, and could benefit from a refactor. In regards to agentic coding, all these comments are extra contents, driving down quality while increasing cost. Agents also tend to be inconsistent about updating comments, I've had cases repeatedly where a comment did not match the code, at which point it is just a documentation liability.