share
Stack OverflowIs writing comments inside methods not a good practice?
[+22] [0] Srini Kandula
[2011-02-28 01:16:14]
[ comments coding-standards ]
[ http://stackoverflow.com/questions/5137330] [DELETED]

A friend told me that writing comments inside methods is not good. He said that we should have comments only for the method definitions(javadocs) but not inside the method body. It seems he read in a book that having comments inside the code means there is a problem in the code. I don't quite understand his reasoning. I think writing comments inside the method body is good and it helps other developers to understand it better and faster. Please provide your comments.

(4) Removed the "java" tag because I think this question's interesting to anyone using any language, even if they don't have inline documentation. - Rei Miyasaka
If there was a java-tag, it was a useful information, since the tool javadoc uses comments above the method, but not comments inside the method. - user unknown
(1) Sounds like he's read Clean Code but only parts of it :-). - Helper Method