logoalt Hacker News

beeringtoday at 8:26 PM9 repliesview on HN

> Changes created by Codex had fewer comments in Ruby/Ruby on Rails code. I liked that a lot, and I will soon share some experiments I ran on this.

Why is fewer comments a good thing?


Replies

muglugtoday at 8:30 PM

Claude can add comments in code that are better just living as a comment on the PR.

You'll ask it to do something and it'll comment the code with an answer to what you asked it, rather than just explanatory comments to whoever comes after.

There's also a second issue that if the code is actually incorrect, the comment can nevertheless bolster the case for it.

show 3 replies
rebeccajaetoday at 8:57 PM

I found that Claude would litter the codebase with what felt like notes-to-self. Sometimes it would make an abstraction that wasn't very well thought out and when I pushed back on this choice, it would usually go with something more along the lines of what I suggested in my pushback, but left a comment like "use the git CLI instead of re-implementing git" or something.

It felt like it was commenting on the diff sometimes instead of what the code was doing.

transdev12today at 9:15 PM

Claude comments look like this

//add returns the sum of x and y

//per section 2.1 of addition-implementation-plan.md sum is designed as the seam for user addition interfaces.

//previously sum added numbers, now it adds numbers

def add(x, y):

    return x + y
show 1 reply
rirzetoday at 8:27 PM

Claude is creating verbose comments with recent models and people are are tired of it

show 1 reply
grim_iotoday at 8:38 PM

Claude comments often contain the whole iterative chain of decisions that led to the current state.

Useful for the LLM to know the "why", but not something a human would do, unless it's a very critical and confusing part of the code.

CollinEMactoday at 9:09 PM

Fewer comments is generally a bad thing.

Fewer AI-generated comments is generally a good thing.

WASDxtoday at 9:19 PM

Good code is self-explanatory and don't need comments.

I can really recommend the book Clean Code, here is a summary: https://gist.github.com/wojteklu/73c6914cc446146b8b533c0988c...

splaptoday at 9:20 PM

I find claude often comments about what the code *does not* do. Relevant at the moment, but doesn't belong in the codebase.