Ensure that method, variable, and class names accurately reflect their actual behavior, purpose, or content. Names should semantically match what they represent to prevent confusion and bugs.
Key principles:
detachX()
should perform get + cancel
, not just cancel
patch_block_indices
not patch_col_indices
when indexing blocksSerialization
not Compression
when the class handles serializationshouldSearchForPartsOnDisk()
not lookOnDisk()
disk
not drive
when referring to storage disksExample of problematic vs. corrected naming:
// Problematic - method name doesn't match behavior
void detachParallelReadingExtension(); // actually just clears/cancels
// Corrected - name matches actual behavior
void clearParallelReadingExtension(); // or implement proper detach semantics
// Problematic - variable name doesn't match content
PaddedPODArray<UInt64> patch_col_indices; // actually indexes blocks
// Corrected - name matches content
PaddedPODArray<UInt64> patch_block_indices;
This prevents misunderstandings about code behavior and makes the codebase more maintainable by ensuring names serve as accurate documentation of functionality.
Enter the URL of a public GitHub repository