Hacker News new | ask | show | jobs
by notanotherycom1 2052 days ago
No joke, I saw a comment in my code base literally yesterday written from a week ago. I said this is crap and it's taking me more than 5seconds to understand and I ended up simply changing some variable names and refactor the function. It took maybe 2 minutes to do but now I don't need a comment and it's cleaner code for future changes. (It's in a file we are actively working on and WILL change)

tl;dr: Refactor not comment

1 comments

Ideally the code should describe what you are doing and how you are doing it.

You might need comments to describe why you are doing something. And you definitely need comments for why you are _not_ doing something else.