DEV Community

Discussion on: A short comment on comments in the code

Collapse
 
stanciudragosioan profile image
StanciuDragosIoan

I disagree with the fact that comments are bad. I tend to favour comments as they are extremely helpful (even if they might seem redundant).

I worked many times in legacy code bases with 0 documentation and 0 comments. I wasted many many days trying to figure out code logic (just to much later understand that in fact the logic was only half of the problem and the other half was lying in business logic - comments would have definitely helped there).

For the reduntant comments, I think they will be good for any new joiner on the project (they might be redundant to you the one who wrote the code but not to some1 completely new).

Yeah you can have descriptive names and yeah code is self explanatory (if the functions/blocks have a decent length and you don t have like 400 + lines functions) but the why behind it is critical in understanding everything.

For my projects I make it as a rule in PR to have comments changed if you edit the function underneath otherwise PR won't pass.