General Naming Principles
mainFollow these core principles to improve code cohesiveness and readability:
- Use English: Use English for all variables and functions to increase cohesiveness with programming syntax and documentation.
- Be Consistent with Conventions: Pick one convention (e.g.,
camelCase,PascalCase,snake_case) and stick to it throughout the project. - Follow S-I-D: Names should be Short (easy to type/remember), Intuitive (reads naturally), and Descriptive (efficiently reflects purpose).
- Avoid Contractions: Do not use abbreviations like
onItmClk; use full words likeonItemClickto improve readability. - Avoid Context Duplication: Do not repeat the class or object name within its own methods. For example, inside
class MenuItem, usehandleClick()instead ofhandleMenuItemClick(). - Reflect the Expected Result: Name booleans based on the state they represent. If a value is
truewhen a button is disabled, name itisDisabledrather thanisEnabledto avoid confusing logic likedisabled={!isEnabled}.
/* Bad */
const primerNombre = 'Gustavo'
/* Good */
const firstName = 'Gustavo'