4 ms·
I tink it's dumb to remove the comments from code, although I agree with making symbol names more meaningful. In the original post, the comment // square root
by gm 18y ago
I tink it's dumb to remove the comments from code, although I agree with making symbol names more meaningful.
In the original post, the comment
// square root of n with Newton-Raphson approximation
Is removed and replaced with the improved function name of SquareRootApproximation(). A good improvement to the code, to be sure, but you lose the information about the code implementing a "Newton-Raphson approximation." The author just glosses over that.... Of course somepne will come back 3 years later and ask themselves, "which algorithm is this?"
So, to tie it back to the topic about business comments, yes, business comments should be there in the code as well. It always helps, and it helps locate customizations that, at first reading do not make sense.
So, comments or better-written code? Both. Redundancy is really good when it contributes to making code more clear.
- moss 18y agoIt's good until you rewrite the function to use a different algorithm, but forget to update the comment. After that, it's a confusing contradiction that will slow down anyone who tries to read the code. If the code is genuinely hard to follow without it, it's probably still worth leaving a comment, but recognize that there are real costs to balance out the benefits of commenting.