Hacker News new | ask | show | jobs
by frigo_1337 3148 days ago
One thing from Clean Code that fundamentally changed the way I write code was the bit about how “Comments Lie”.

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.

2 comments

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.
Thinking code can be "self-documenting" is one of the biggest delusions of this field.
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.