Common275 Documents

Function Name Matches Action Or Return Value

A function name must accurately describe its action or return value, including its scope. A generally named function must fulfill that general contract; do not hide a feature-specific implementation behind a broad name. For example, getPanelSettings must return the complete merged panel settings, not only onlyLightMode. If a function intentionally performs a narrower action or returns a narrower value, name it accordingly. Keep the implementation, name, and contract aligned as requirements evolve.

Philosophy

Callers should understand a function’s purpose from its name without discovering a hidden restriction in its implementation.

Correct

getPanelSettings returns the complete merged panel settings.
getOnlyLightMode returns only the light-mode setting.

Fix

Implement the full action or return value promised by the function name, or rename an intentionally narrower function to describe its actual responsibility.