4 ms·
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 test
by gernb 4y ago
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.