As you create your Alice virtual world you will need to make up names for the objects, variables, and methods that you add.
The following conventions help programmers to write code that is easy to read and understand.
- Classes start with an upper case letter.
- Constants are all uppercase: PI for instance is a constant, it always has a value of 3.14...
- Everything else starts with a lower case letter.
- After the initial letter, you may use more letters, digits and underscore.
- Names cannot have a space! Programmers use an uppercase letter to separate words instead of the space: for instance bigRabbit or greenMushroom. This style is called camel case. It makes it easy to see where each word begins.
- It is very important to use meaningful names. Names of objects are usually a noun or an adjective and a noun: chicken or littleChicken and bigChicken. Sometimes a digit is added: pixie1, pixie2, pixie3 for instance if you will be working with them as a group.
- Do not use single letters for variables except when they are used to count.
- Be consistent. If you develop a naming convention and stick to it, it will be much easier to remember what you have named things.
End of lesson, Next lesson: