Communal commenting is a team based approach to writing clear, useful comments.
It may be a useful approach to take if you find yourself encountering no shit sherlock comments.
When developers are writing code, they have their mind buried in many and deep levels of context for hours at a time. As a result, when we do this we are often in the worst position to understand what is and what isn't obvious to the code reader approaching without context.
Worse, the cognitive load of writing code is such that extraneous concerns usually have to be dispensed with - i.e. empathetically putting yourself in the shoes of the code reader and considering what additional context they would like to see.
This weight can be lifted by simply ignoring comments completely until there is a pull request and writing in comments which serve as answers to questions asked by reviewers.
Unlike the code writer, the reviewer will also usually be better able to have a holistic view of the code and understand both what is and isn't obvious.
- Write code WITHOUT any comments and submit a pull request.
- Ask your team to review it and to comment wirh questions when they cannot easily discern what is going on or why.
Turn the answers of the questions into:
A docstring or comment in the code.
- A new glossary entry.
- More detailed explanation in a test executing the code.
- Documentation explaining background and the rationale behind decisions.