Documenting Member Variables/Fields/Properties [DI26] [WHAT] [WHY] [HOW]

Documenting Member Variables/Fields/Properties [DI26] [WHAT] [WHY] [HOW]

Tip DI26

Member variables/fields/properties have a scope that falls somewhere in-between local variables/parameters and global data. That extra scope means more care in documentation can be important, particularly if member variables/fields/properties are public and form a key part of the interface to a data type.

Variables that belong to a custom data type like a struct/class are “member variables” of that type (also known as fields or attributes). They have a close cousin of “properties” in many programming languages, where properties provide a simple data-like interface similar to regular member variables, but under-the-hood are functions that dynamically compute data.

With there larger scope than local variables and the ability to form interfaces, they can be important to document.

Examples:

Code More Meet Less Ad.png