Names should clearly describe what they represent or do, rather than how they're implemented or using generic terms. Avoid abbreviations and use full, descriptive words that accurately reflect the purpose and behavior of the code element.
Names should clearly describe what they represent or do, rather than how they’re implemented or using generic terms. Avoid abbreviations and use full, descriptive words that accurately reflect the purpose and behavior of the code element.
Key principles:
_scrollToFirstSelectableDate instead of _checkOnCustomDaysDisplaylineHeightFactor instead of lineHeight, avoid “hsw” for half_stroke_widthExpectedFrameConstraints instead of ExpectedFrameSize when returning constraintstraversalOwner instead of overlayPortalParent to avoid widget-layer conceptstext_frame in C++, avoid anonymous parameter names like _k for constants (kSystemToolbarToggleDebounceThreshold), handle for callbacks (handleSystemHideToolbar)Example of good descriptive naming:
// Bad: Generic and unclear purpose
void _checkOnCustomDaysDisplay() { ... }
// Good: Clearly describes what the function does
void _scrollToFirstSelectableDate() { ... }
// Bad: Abbreviation
final double hsw = half_stroke_width;
// Good: Full descriptive name
final double halfStrokeWidth = half_stroke_width;
This approach improves code readability and maintainability by making the codebase self-documenting through clear, purposeful naming.
Enter the URL of a public GitHub repository