Private Methods

Robert C. Martin

In his book Clean Code Robert C. Martin is vehemently arguing against documenting private methods, calling them an anathema being little more than cruft and distraction (p. 71).

If the method has an expressive name and also expressive names for its parameters and does only one thing, then a private method it seems reasonable to do not comment.

What we do

We started with comments on all private methods. We even has a rule in our static analyzers to check for missing comments. But this added little value. Now we follow Robert C. Martin's advice and spend more time on the naming of the methods. If we fail to find a good name, we admit this by adding some comments.

Conclusion

Our advice is think hard about expressive names and not comment private methods.