DEV Community

Discussion on: A short comment on comments in the code

Collapse
 
baenencalin profile image
Calin Baenen

Please, think twice before adding comments to your code. Probably, there are no needed and will just confuse people who will read your code later on. Write a clean, readable code instead. Thanks in advance!

What about doc-comments, for example in Rust with ///?
Those are used to generate documentation later on and IDEs like VSCode use it to give you helpful descriptions when hovering over types.

Adam Crockett (whose name I swear I've seen before) makes a good example of this in their comment.

Collapse
 
imcheesecake profile image
Freddie • Edited

This. I never use comments for functions because the name should be a good enough description.
However, I almost ALWAYS put comments over my properties because I HATE not knowing what the property is used for when I have to use another teams stuff. And also it helps when you get the intellisense bubble... and also with Storybook.