Summarize What a Function Does [DI15] [WHAT]
Tip DI15
The first part of a good function overview is a summary of what the function does.
A summary doesn’t have to be long - it can be as short as a single sentence. The following shows several concise summaries for various function signatures (documentation for other things like parameters are important but omitted here - we’ll get to those later):
If you can concisely, clearly, and accurately describe a function in a single sentence, that is often a good sign of its simplicity, cohesiveness, and understandability to others.
However, if you’re struggling writing a concise and easily-understandable overview for a function, that’s a warning sign that it might be too complex or you lack sufficient understanding of its role in the broader codebase. Revisit the design, refine your understanding, and simplify if needed.