7
nibor
6y

Comments belong here on devRant, not in your code!

Code cleanly folks.

“Good code is its own best documentation. As you’re about to add a comment, ask yourself, ‘How can I improve the code so that this comment isn’t needed?'”
– Steve McConnell 

Comments
  • 7
    Oh I beg to differ here. Especially when programming in a field like ERP.

    Yes the code is good when it tells you that a specific thing is being done. But without any comment why it is done, it's a nightmare for anyone who looks at it afterwards.

    I don't know how often I heard sentences like: Why the fuck is this value here subtracted from this value.

    I hear something like that all the time when it comes to tax calculation.

    Yes you can look at the documentation (good luck with finding any details about that specific calculation).
    But a comment in code would help a lot.
    Even if it just points to a specific line in the documentation.
  • 13
    Code itself should explain what is done. Comments should explain why something is done.
  • 4
    Comments are needed for context and "why" -- which even superior clean code cannot provide.
  • 5
    People regurgitate this stuff like theyre in a cult.

    COMMENTS ARE USEFUL

    You dont have to go nuts,you dont have to write an essay but a small explanation can be incredibly useful to the person that comes after you.
  • 4
    Fuck off with that bullshit mentality.

    Don't be a cunt and comment your fucking code.
  • 2
    Yeah have fun maintaining code that makes perfectly clear WHAT is being done but not WHY. Try adding features to that without knowing the rationale of the existing stuff. Have fun when the existing tests suddenly fail and you have to figure out why.

    Does anyone remember the Debian key disaster from 2006-2008? That was because a maintainer out commented two lines of code to remove valgrind warnings because he saw what the code was doing, but not why these lines were important.
  • 1
    Nah bruh. Comment that shit. If it makes you feel better learn some framework that will turn your comments into documentation. But absolutely use some type of commenting scheme.
Add Comment