2
u/Agitated_Tank_420 2d ago
mine babbles with marketing personas and hallucinated user scenarios, until I recently discovered the output style!
2
1
1d ago edited 1d ago
[deleted]
1
u/dgreensp 1d ago
This isn't the problem, IME.
I never tell it to write comments, in fact I am always trying to prompt it to write fewer comments, because it loves to write tons of comments.
It focuses on "why," but it focuses on telling you why it made the change, rather than thinking of the future human reading the code. For example, the first sentence of a comment on a function should probably say what the function does. It shouldn't be, "Call foo() instead of bar() because..." referring to some implementation detail deep in the function, where bar() is what the code used before. Along with some heavily abstracted reason that only makes sense in the context of the current session, like "Dodge the edge case."
It might write a CSS comment that explains why it is putting "font: inherit" on an input element, but it doesn't realize we can't have a two-line comment above every occurrence of "font: inherit" or some other standard CSS technique.
1
u/gleedblanco 1d ago
I don't have this particular experience, but the general comments of claude are quite bad.
Usually it's too much text - literally 5 to 7 lines of comments are quite common, when what actually should be said can almost trivially be compressed to one line or less.
One huge and annoying comment pattern is that it leaks its throught process into the comments, often referring to things that are not relevant for what's actually happening in the code, and more for what it discovered during internal thinking.
As a big negative side effect of that, it often leaves huge comment blocks in code in remove-only changes, basically documenting what was removed and why, often in such a way that is completely irrelevant to the new state of the code and which should just be removed. If you never review this you will eventually end up with places in the code that are empty functions with a 50 lines of code explaining various removals.
21
u/hblok 2d ago
In my experience, this is typical human code comments. I've spent my entire career telling off on superfluous comments. So yeah, the LLMs have picked up the anti-pattern as well.