DEV Community

Discussion on: To comment or not to comment?

Collapse
 
lankydandev profile image
Dan Newton

How strong is your emphesis on hard fought here?

Are you only talking about longer functions / functions that are doing really complex stuff? Or do smaller / simpler functions also warrant comments?

Basically, how far do you think we should take this and at what point is naming no enough and comments need to step in?

I'm not disagreeing with you, I think I have actually been gravitating to what you just said. Although I do not document private functions to often and instead normally comment on inside if it is doing some funky stuff. Maybe that is something I should change.

Collapse
 
laurieontech profile image
Laurie

It’s definitely based on personal discretion.

I think hard fought code that results in a simple solution doesn’t necessarily need a comment. But code that wasn’t intuitive to write is probably not intuitive to read, so that context and explanation is helpful.