Naming your variables properly
Always use meaningful names for storing your variables. If you don't do that, six months down the line, you will be sad. I'm going to exaggerate here a little bit to make a point. I will name a variable as shown in the following code:
public bool theBearMakesBigPottyInTheWoods = true;
That's a descriptive name. In other words, you know what it means by just reading the variable, and so ten years from now when you look at that name, you'll know exactly what it means. Now suppose instead of theBearMakesBigPottyInTheWoods
, I had named this variable as shown in the following code:
public bool potty = true;
Sure, you know what potty
is, but would you know that it referred to a bear making a big potty in the woods? I know right now you'll understand it because you just wrote it, but six months down the line, after writing hundreds of other scripts for all sorts of different projects, you'll look at that and wonder what potty
meant. You...