Provide Good Domain-Specific Parameter Names
We write code once but read and change it many times, sometimes thousands of times. The considerations for the ease and cost of reading the code should outweigh those for writing the code the first time.
You’ve probably seen your share of poor names for lambda parameters. For some reason, x seems to be one of the most favorite bad names for parameters. Other poor choices seem to include p, k, and so on, with the worst offender being l—is it the number 1 or the letter l, the reader may wonder. It’s likely that programmers picked up such practices from an example in a presentation, a book (such as this one), or a blog post. Whereas these short, cryptic names may be suitable for a quick example, unfortunately, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access