Names should clearly indicate their purpose and context to avoid confusion, especially when similar concepts exist in the same scope. Generic names like "api", "params", or "arg1" create ambiguity and make code harder to understand. Instead, use specific, meaningful identifiers that describe what they represent or do.
Names should clearly indicate their purpose and context to avoid confusion, especially when similar concepts exist in the same scope. Generic names like “api”, “params”, or “arg1” create ambiguity and make code harder to understand. Instead, use specific, meaningful identifiers that describe what they represent or do.
Examples of improvements:
params
(which resembles useParams
hook) with descriptive alternatives like target
index
instead of generic arg1
, arg2
api
with descriptive alternatives that indicate their actual purposeThis practice becomes especially important when multiple similar concepts exist in the same scope, as clear naming prevents confusion and improves code maintainability.
Enter the URL of a public GitHub repository