Names should clearly communicate their purpose, type, and behavior to improve code maintainability and accessibility. Avoid misleading or ambiguous terminology that can confuse developers or users.
Key principles:
ProposedShortcutActionName
over ProposedShortcutAction
when the value is specifically a string.required
for validation checks when it’s not actually a boolean requirement flag.AutomationProperties.Name
with descriptive text rather than leaving buttons to be read as just “button”.ScrollToZoom
instead of DisableMouseZoom
to avoid double negatives and improve clarity.Example of improved naming:
// Before: misleading parameter name
#define DECLARE_ARGS(type, name, jsonKey, required, ...)
// 'required' is actually a validation expression, not a boolean
// After: clearer parameter name
#define DECLARE_ARGS(type, name, jsonKey, validation, ...)
// 'validation' clearly indicates this is a validation expression
// Before: unclear type
VIEW_MODEL_OBSERVABLE_PROPERTY(IInspectable, ProposedShortcutAction);
// After: type-indicating name
VIEW_MODEL_OBSERVABLE_PROPERTY(IInspectable, ProposedShortcutActionName);
This approach reduces cognitive load, improves accessibility, and makes code self-documenting.
Enter the URL of a public GitHub repository