Hacker News new | past | comments | ask | show | jobs | submit login




Cool I had never seen this before. All seem on point, but I have light disagreements with this one:

> The basic rule: the further from its declaration that a name is used, the more descriptive the name must be. For a method receiver, one or two letters is sufficient. Common variables such as loop indices and readers can be a single letter (i, r). More unusual things and global variables need more descriptive names.

In the tighter parts of some algorithms I love seeing more descriptive variables (obvious exclusions, as noted, are things like i, j, x, y). It's very common to see double letter variable names that become hard to track (plenty in the go source as well).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: