4 ms·
Should You Comment Your Code?
- Randgalt 12y agoRule #1 - Comments lie
- 0xDOOD 12y agoIf you want to, yes. If you don't, I feel sorry for whoever has to maintain your code.
- hwgd 12y agoCommenting code only works if other people who change the code also bother to change the comments
- _lce0 12y agoLeaving aside code documentation (aka dockblocks), I can think of dozen of examples where you MUST comment you code.. - strict order of execution - math formulas in the code (or its results) - external systems requirements/hacks - non-explicit side effects - legacy or costly known issues - intention of cryptic code - design choices (and its tradeoff) - .. This obviously implies you actually care about who will maintain such best
- simonblack 12y agoComments are an act of kindness towards the person who will be doing the maintenance on the code you have written. It's doubly kind when that code maintainer is yourself.