6

Raise your hand if you don’t trust the comments in code most of the time, and take at least a superficial look at the code block to ensure that it does what it says it does.

If you have any exceptions, please share.

Comments
  • 1
    I read the comment and then the code is clear. If I read the comment and the code is not clear, which is rare, then it's probably not correct. No logical connection, that's just how it usually is imo
  • 4
    the problem with the comments is that most just don't update them when changing smth, so I trust them when they are mine and I know no one has changed anything there ;)
  • 8
    I don’t trust comments at all.
    You probably heard it before but in case you didn’t:

    Comments shouldn’t describe what the code does!
    Comments should be rare and only applied to places where it’s unclear why the piece of code is there. Or why it is written this way rather than another way, if it’s unexpected or unusual.
    Everything else should be self describing code with good names and structure and mostly without useless comments.
  • 0
    @Lensflare interesting. How do you define when something is unusual enough to merit a comment?
  • 2
    @chaosesqueteam no, no and no. there is no way I write in the comments my mental state

    and on the topic : yep the comments should be rare and only if the structure of the code does not easily show it's purpose
  • 2
    @chaosesqueteam that's cool and all, but the comments are for all and mainly for the future maintainer ( even if that's you )
  • 0
    @chaosesqueteam like :

    //had to smoke some weed to finish this
    //too drunk to code - finish it tomorrow
    //I think I take too many shrooms

    nah, don't think that they will help me remember what I was thinking when writing the code...
  • 0
    @chaosesqueteam my thoughts are too chaotic for such comments ;)
  • 0
    @chaosesqueteam may I should take the same shit too to bring the memory faster to that same save point ;)
  • 3
    @chaosesqueteam No. You can write comments for WIP code to remind you of the current state, but those comments should be removed after that part of the code is done.

    Just imagine a code base full of comments about what the writers were thinking at that time, which is completely irrelevant by now.
  • 2
    Never trust the comments. If you see any delete them. The code should be self documenting. Fucking comments always lie.
  • 1
    @nanobot experience and common sense
Add Comment