Choose clear, self-explanatory names that prioritize readability over brevity. Avoid abbreviations, obscure identifiers, and names that require domain knowledge to understand. Names should be immediately comprehensible to newcomers and future maintainers.
Choose clear, self-explanatory names that prioritize readability over brevity. Avoid abbreviations, obscure identifiers, and names that require domain knowledge to understand. Names should be immediately comprehensible to newcomers and future maintainers.
Key principles:
toNetworkOrderHex()
instead of toNEHex()
)kjExceptionToJs()
instead of makeInternalError()
)allowNonObjects
instead of ignoreNonObjects
)$class
that use special syntaxtypescriptErasableSyntax
over custom terms)Example:
// Poor: Abbreviation unclear to newcomers
kj::String toNEHex() const;
// Better: Full descriptive name
kj::String toNetworkOrderHex() const;
// Poor: Obscure identifier without context
auto actorClass = options.$class->getChannel(ioCtx);
// Better: Add explanatory comment
// $class uses $ prefix to avoid keyword conflicts in JSG API
auto actorClass = options.$class->getChannel(ioCtx);
This approach reduces cognitive load, improves code maintainability, and helps onboard new team members more effectively.
Enter the URL of a public GitHub repository