1

Possible Duplicate:
Should I document my private methods?

Is it good practice write comment for private fields and private methods? I've write a simple library and I don't really know if add comment for my private fields or not.

Community
  • 1
  • 1
bit
  • 934
  • 1
  • 11
  • 32
  • If you feel they're needed then its good practice – Alex Aug 08 '12 at 15:26
  • Commenting is never a bad thing.. I'd rather see comments than not see them.. also if you are thinking about XML Comments for future purposes in regards to help file use it on all methods.. – MethodMan Aug 08 '12 at 15:26
  • 1
    If they need them. To counter previous opinions, commenting the obvious IS a bad thing and contributes to a high noise to signal ratio in code. If the usage is immediately apparent, don't bother. – spender Aug 08 '12 at 15:26
  • Is this the kind of thing that would belong in the *programmers* section of SO? – BlackVegetable Aug 08 '12 at 15:27
  • I like understandable code more then comments (meaningful names for example). I add comments only if it is necessary. – Amiram Korach Aug 08 '12 at 15:28

1 Answers1

1

If you have something relevant to say, it is a great idea to document it even for private members, as a guideline for future maintenance of the class. But boilerplate comments like "Gets or sets the Foo property" is pure noise for private code IMO.

Jonas Høgh
  • 10,358
  • 1
  • 26
  • 46