Documenting Parameters

Documenting Parameters

Document All Parameters

COMMENT-FUNCTION-PARAMETER

Function parameters form a key interface to using a function. Make sure parameters are documented so that users can use your function.

Parameters are just a specific kind of variable, so much of the guidance on variable documentation applies to them as well. However, with parameters, pay special attention to what users need to know about parameters “before,” “during,” and “after” a function:

  • Are there specific initial states that parameters are expected to be in?

  • Are some parameters input-only (not modified), input-output (used as input but also modified/updated during the function), or output-only (essentially cleared and then fully-populated by the function, like extra return values)?

  • For output parameters, under what conditions are they populated? Are there cases where they might be partially/incompletely populated?

Tap into your teams collective wisdom ad.png

Examples:

Additional Parameter Documentation Tips

See the following for more tips and examples regarding function parameter documentation:

 

Busy coding or busy meeting ad.png