re: Data Scientists and Software Engineering VIEW POST

re: I couldn't agree more... Ultimately the comment will deviate from the code so will become a lie! Your code should be your comment (there may be a...

Indeed, that's the main point: people rarely update the comments when the code gets changed, so the comment becomes misleading.

But it's not the only reason... most times, comments are a smell that some piece of code is too complex. Of course, the problem is the complex code, not the comments... but if you feel the need of commenting, better refrain and try to refactor it instead.

About when to comment... in my case, I do it when I write ugly code purposely. It may be due to a performance tweak, ugly but needed, or because the cleaner version generates an unexpected problem. Both of them happens rarely, but may happen, and then better advice the next one against trying to refactor (or be very careful).

code of conduct - report abuse