What are your “hard rules” about commenting your code?

前端 未结 21 1964
野性不改
野性不改 2020-12-31 16:09

I have seen the other questions but I am still not satisfied with the way this subject is covered.

I would like to extract a distiled list of things

21条回答
  •  南方客
    南方客 (楼主)
    2020-12-31 16:26

    We wrote an article on comments (actually, I've done several) here: http://agileinaflash.blogspot.com/2009/04/rules-for-commenting.html

    It's really simple: Comments are written to tell you what the code cannot.

    This results in a simple process: - Write any comment you want at first. - Improve the code so that the comment becomes redundant - Delete the now-redundant comment. - Only commit code that has no redundant comments

提交回复
热议问题