Prompt
Choose names that clearly indicate their context and purpose rather than generic terms. Generic names can be ambiguous and make code harder to understand, especially when the same codebase handles multiple contexts or domains.
When naming variables, parameters, methods, or classes, prefer specific descriptive names that include relevant context over broad generic terms. This makes the code self-documenting and reduces the cognitive load for other developers.
Examples of improvements:
- Use
libraryinstead ofrepowhen referring to a software library specifically - Use
pdf_hi_res_max_pagesinstead ofmax_pageswhen the parameter specifically limits PDF processing in high-resolution mode - Use
sourceanddestination(lowercase) instead of capitalizedSourceandDestinationfor common technical terms
The goal is to make names immediately clear about what they represent without requiring additional context or documentation.