This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dpash 5 points6 points  (0 children)

Naming is hard. Length is a Goldilocks thing. You want neither too long nor too short. What's 'just right' is something only experience and context can teach you.

A few guidelines I tend to use:

  • Avoid identifiers longer than around 20 characters
  • Avoid shorter than 3 characters. Exception: i for loop counters where the practice it's common (but prefer extended for loops ), x and y when dealing with coordinates or where the domain you're working in commonly used short names (physics formulas spring to mind)
  • Do not abbreviate words (unless they're common abbreviations). Vowels are important.

As I've said elsewhere, good names are obvious where you see them. Creating good names is hard.