News for hackers. Stuff that matters.
Re:The Shapes of Code by clarry on Tuesday January 28, 2020 @09:33AM (#22169666)

   const database_year_offset = 7;

   fix_start_year(year):
       return year + database_year_offset;

   process_record(record):
       record['start year'] = fix_start_year(record['record']);
In this version with one less magic constant (and renamed function), the comment would look very redundant.

DougBTX had the same idea, at the same time. I don't think their version needs the comment either. EDIT: Dang you removed a perfectly fine post :)

Re:The Shapes of Code by nerdponx on Tuesday January 28, 2020 @09:50AM (#22169838)
I guess, but I think it's more that my example fails to illustrate the point well.

Informative comments cannot always be "factored out" like this. Do you at least agree that a ticket or bug #, or a link to an issue in an issue tracker, would be appropriate?

Re:The Shapes of Code by clarry on Tuesday January 28, 2020 @10:08AM (#22170041)
I think a comment is appropriate if the problem cannot be factored out. But in my experience such things can be factored out most of the time, hence the argument that most code should be boring and immediately obvious.
Re:The Shapes of Code by Firadeoclus on Tuesday January 28, 2020 @10:37AM (#22170320)
Factoring out a comment into code sometimes loses information. I would argue that database_year_offset is not as informative as the original comment. Free form text can say things better than identifier names.
Re:The Shapes of Code by nerdponx on Tuesday January 28, 2020 @07:21PM (#22175751)
Most code, sure. But it's not an ideal to be striven for, or a metric to be used when evaluating code.