News for hackers. Stuff that matters.
Re:I’m a productive programmer with a memory of a fruit fly by gernb on Tuesday September 20, 2022 @02:20AM (#32908318)
IMO there is some common sense to comments that is often not followed. Example: I work on a project that has a pre-submit script that requires comments for tests. This leads to ridiculousness where I have code like

    // Test that uploading data with XYZ function works
    TEST(UploadingDataWithXYZFuncWorks) {
      ...
    }
Like WTF! The function name says all that needs to be said. There are is no more info needed but I had to appease some over zealous programmer.

Meanwhile, in an existing test in the same file I see code like this

    // Set the dimensions
    SetDimensions(0, 0, width, height)
Again, WTF!

Comments are important for explaining why something exists, what its assumptions are, edge cases, etc..., but you can also go overboard with comments and you can make your code more readable by using readable names for functions and variables.

There are no comments on this comment yet.