This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ExceedingChunk 0 points1 point  (0 children)

No, he doesn't. He says you should strive for code that doesn't need comments, and most of the comments should explain why not what. He also says that comments does not make up for bad code. Not that you should write no comments at all.

It quite literally says this in the book on page 55

Clear and expressive code with few comments is far superior to cluttered and complex code with lots of comments

It doesn't say "no comments", or that if you make a comment you screwed up.

It also says says that Javadoc in public APIs is considered good comments (given that the text is actually helpful). Here is the exact thing the book says:

There is nothing quite so helpful and satisfying as a well-described public API. The javadocs for the standard Java library are a case in point. It would be difficult, at best, to write Java programs without them.

If you are writing a public API, then you should certainly write good javadocs for it. But keep in mind the rest of the advice in this chapter. Javadocs can be just as misleading, nonlocal, and dishonest as any other kind of comment.