DEV Community

Discussion on: "Do not comment on your code, it should be self-documented". Well... I don't agree.

Collapse
 
hugozap profile image
Hugo Zapata

Comments are a way to communicate with your future self or other developers about the intention of the code, potential pitfalls, warnings, etc. Having comments in code means there's additional context information directly related to the source code.

I see comments as good etiquete and feel grateful for whoever took the time to write them, they have been valuable to help navigate codebases. Sure you could do it without code but why waste valuable mental bandwidth trying to figure out stuff that can be easily put in comments?

They are good, use them!