DEV Community

Discussion on: To comment or not to comment?

Collapse
 
danielhutchinson profile image
Daniel Hutchinson

I use them as a design tool.

I tend to only write comments when designing, it's my way of thinking out loud. Stating what I want to achieve before writing any code. I then replace these comments with the actual implementation.

A trick I learned from another Dev at my day job is to write comments at the top of my classes to explain what they do, if I put the word "and" in there then I know the class probably does too much. Then I delete the comment (or sometimes just do this in my head)

Collapse
 
lankydandev profile image
Dan Newton

I comment code to note down what I want to do as well. The problem I used to have was deleting these comments before committing :(