I hear this quite a bit, and think there’s actually a good deal of nuance to it. I’ve seen places that insisted on comments for everything, and it was silly, a significant number of comments had no value. This made people not read comments, as opposed to other places I’ve worked with very few comments - when you ran across a comment you gave it more weight (something here was complex, or not as simple as it seemed).
So imo, use comments which can communicate effectively, but use them sparingly for important parts that are complicated, for the rest attempt to communicate with the code itself.
bigbluealien@kbin.social 1 year ago
Stage 2, "why does this code have nothing to do with the very detailed comments?"
Traister101@lemmy.today 1 year ago
Always comment the why, not the what
NegativeLookBehind@kbin.social 1 year ago
git blame
Savaran@lemmy.world 1 year ago
If the comments don’t match the code then someone failed to properly review it.
MajorHavoc@lemmy.world 1 year ago
Lol. That’s why we comment with “why”, rather than “what”. The answer to “what the duck where we even thinking?” usually doesn’t need updated until the commented code goes away.
Suppoze@beehaw.org 1 year ago
Never understood this argument, it’s the person’s responsibility who change the code to update the comments if needed. Otherwise they just implicitly admit that they did not read it and understand the context, or just plain does not care.
sebsch@discuss.tchncs.de 1 year ago
It just never works. Its important documentation breaks if changes are made. The best docs are baked into unittests