Choose names that reflect the semantic purpose and meaning rather than implementation details or internal mechanisms. Names should communicate what something does or represents from the user's perspective, not how it works internally.
Choose names that reflect the semantic purpose and meaning rather than implementation details or internal mechanisms. Names should communicate what something does or represents from the user’s perspective, not how it works internally.
For example, prefer on_response
over on_exit
for HTTP request callbacks, since “response” describes the semantic event while “exit” exposes the internal detail that curl process exits. Similarly, use version
to describe the semantic concept rather than checkout
which exposes the Git implementation detail.
Follow established project conventions consistently:
on_
prefix for event-handling callbacks and handlerscallback
for continuation functions (single callback parameter)Example of good semantic naming:
-- Good: describes the semantic purpose
vim.net.request(url, opts, on_response)
-- Poor: exposes implementation detail
vim.net.request(url, opts, on_exit)
When multiple naming options exist, prioritize the one that best communicates the intended use and meaning to other developers, while maintaining consistency with existing codebase patterns.
Enter the URL of a public GitHub repository