Comment by ape4
21 hours ago
The article says there aren't too many useless comments but the code has:
// Get the Origin header from the request
const origin = request.headers.get('Origin');
21 hours ago
The article says there aren't too many useless comments but the code has:
// Get the Origin header from the request
const origin = request.headers.get('Origin');
Those kinds of comments are a big LLM giveaway, I always remove them, not to hide that an LLM was used, but because they add nothing.
Plus you just know in a few months they are going to be stale and reference code that has changed. I have even seen this happen with colleagues using llms between commits on a single pr.
Of course, these are awful for a human. But I wonder if they're actually helpful for the LLM when it's reading code. It means each line of behavior is written in two ways: human language and code. Maybe that rosetta stone helps it confidently proceed in understanding, at the cost of tokens.
All speculation, but I'd be curious to see it evaluated - does the LLM do better edits on egregiously commented code?
It would be a bad sign if LLMs lean on comments.
Excessive comments come at the cost of much more than tokens.
I also noticed Claude likes writing useless redundant comments like this A LOT.
IMO, this is much better than the status quo. Most programmers are terrible about writing clean code with good comments. I would much prefer this style over unreadable mess (especially if it’s a language/framework I’m not comfortable with).
But of course, it’s not an either-or. Ideally, I agree LLMs would provide slightly fewer comments.