Comments are really useful to explain reasoning behind complex sections, or edge cases that caused code to be written. Other than that I hate boilerplate comments, and try to make code self documenting.
Re:The Art of Code Comments
by inertiatic on Friday November 03, 2017 @11:05PM
(#15623582)
Thinking code can be "self-documenting" is one of the biggest delusions of this field.
Re:The Art of Code Comments
by abritinthebay on Saturday November 04, 2017 @01:03AM
(#15623885)
You’re being downvoted but it’s extremely true.
Code should strive to be as self-documenting as possible but there will always need to be some level of documentation- and good comments are part of that.
One other part of that effort should be good unit, integration, and acceptance, tests.
I hadn’t really thought about it much before. But since then, I see lying comments absolutely everywhere. Many of which I have written myself. The author is right, comments are really hard to maintain.
Nowadays I try my absolute hardest to avoid writing comments. 9 out of 10 times, it can be solved with some refactoring.