DEV Community

Discussion on: ✨ 5 damn easiest soft skills💡 needed to become a 10X🔥...Yes...10X🔥 Software Engineer ✔️

Collapse
 
willsmart profile image
willsmart

Totally agree!
The senior devs I've worked with tend to end up removing more comments than they add.
Excessive comments tend to be removed during peer review.

Comments are essential where it's hard to get the intention of the code by reading it, which is sometimes unavoidable but should be the exception not the rule.
Clear code shouldn't need comments. Tricky code does. No use filling your codebase with tricky code.

Collapse
 
mrsaeeddev profile image
Saeed Ahmad

Yeah. Comments should be removed in peer review. They are just to give understanding of something tricky. Complex code should be avoided if it's not needed.

Thread Thread
 
mattmoranjava profile image
Matt Moran

Comment to document the why of the code, not the what. What it's doing should be immediately apparent, but why the client wants it to do that may be important for future maintainers. The last thing you want is for some new dev to rip out something that makes little sense, only to find themselves hauled into the CTO's office to explain why they've gone against the client's wishes & be embarrassingly made to restore it in an emergency release.