DEV Community

Discussion on: You should write a comment on every line of code

Collapse
 
scottshipp profile image
scottshipp

I understand the desire to propose a dogmatic and extreme point-of-view around things like comments. But it isn't helpful to say "never write any comments" any more than it is helpful to say "comment every line" in my opinion. The truth is somewhere in the middle. And I personally think that because human psychology is what it is, you should first try to write code without comments and ask yourself if it is as clear as it can be, then refactor to something clearer, before you write the first comment. And I agree that any comments you write should be "why" comments as opposed to what I see far more often which is "how" comments. The code is telling you "how" the application will handle some use case. The "why" is more important.

Some comments have been hidden by the post's author - find out more