Choose names that accurately reflect the purpose, scope, and semantics of variables, methods, and classes. Names should be self-documenting and eliminate ambiguity about what the code element represents or does.
Choose names that accurately reflect the purpose, scope, and semantics of variables, methods, and classes. Names should be self-documenting and eliminate ambiguity about what the code element represents or does.
Key principles:
updateVoterPeriodTimer
โ updateVoterSetPeriodTimer
when it handles add, remove, and update operations)isMarkedArchived
โ isTerminalState
for a boolean indicating no further state transitions)getInternalTopics
โ getInternalTopicsToBeDeleted
when the intent is deletion)boolean isReconfigSupported
instead of generic parameter names)Example improvements:
// Before: Ambiguous about what "messages" vs "records" means
int maxInFlightMessages;
// After: Consistent with codebase terminology
int maxInFlightRecords;
// Before: Unclear what constitutes "marked archived"
private boolean isMarkedArchived = false;
// After: Clear semantic meaning - no further transitions allowed
private boolean isTerminalState = false;
// Before: Generic parameter name requiring context to understand
public void testMethod(boolean withKip853Rpc)
// After: Self-documenting parameter name
public void testMethod(boolean isReconfigSupported)
Well-chosen names reduce the need for comments and make code intentions immediately clear to readers.
Enter the URL of a public GitHub repository