Re:Comments Are Code (2018)
by armchairhacker on Thursday March 07, 2024 @08:08PM
(#39636604)
Comments are very important, but I wouldn't call them "code" because they're not checked. This is one area I predict will be very important in the future, possibly with the help of LLMs: comment checkers. They'll not only ensure the comment isn't factually incorrect, but that there aren't sneaky edge cases (or not-so-sneaky, not-so-edge "oh I forgot to mention [the most important part]...") missing from the comment.
[ Parent
| on HN ]
Re:Comments Are Code (2018)
by paulddraper on Thursday March 07, 2024 @08:10PM
(#39636618)
> But wait! The comments will get out of sync with the code! Well, they shouldn’t. When we perform our code reviews, we need to review the comments as well as the code. Comments should be correct, understandable, and valuable; we need to keep these points in mind during our reviews.
Problem solved, apparently.
Why use CI to check your code automatically and reliably when you can do it manually and unreliably?
CI makes a good prerequisite for code review. It's a terrible substitute for it.
Re:Comments Are Code (2018)
by bravetraveler on Thursday March 07, 2024 @08:52PM
(#39636936)
But, return code 0 /s
I had a code review once where I had a comment on line 16 saying do X because Y referring to the code on line 17.
During code review, someone asked, why are you doing X on line 17?
Not necessarily. If the diff is in the body of the function, a lot of review tools won't even show the unchanged comment lines above it. It's easy to overlook some drift between what the comment says a function does, and what it actually does.
Re:Comments Are Code (2018)
by lazyasciiart on Thursday March 07, 2024 @10:09PM
(#39637399)
Yea. Some are about smart enough to show the name of the method even if it’s out of view, I wish they could expand to include header comments.