Prompt
Names should be descriptive and specific enough to clearly communicate their purpose and avoid confusion. This includes using full words instead of abbreviations, being domain-specific when necessary, and ensuring names accurately reflect the function’s behavior or data’s purpose.
Key guidelines:
- Use full words instead of abbreviations:
isRightToLeftLocaleinstead ofisRtlLocale - Be domain-specific to avoid naming conflicts:
getSentFolderCandidatesByRegexcould begetImapSentFolderCandidatesByRegex - Avoid ambiguous names that could cause confusion:
FlatEntityMapsCacheServicevsWorkspaceFlatMapCacheService - Use descriptive variable names:
stepExecution.resultinstead ofresult.result - Be specific about scope and context:
useUpdateMultipleRecordsFromManyObjectsinstead ofuseUpdateManyRecordsFromManyObjects
Example:
// ❌ Ambiguous and abbreviated
const isRtlLocale = (locale: string) => { ... }
const mergeInProgressState = atom({ ... })
// ✅ Descriptive and specific
const isRightToLeftLocale = (locale: string) => { ... }
const isMergeInProgress = atom({ ... })
This helps with IDE autocompletion, reduces naming conflicts, and makes code more self-documenting for better maintainability.