Choosing Names
Lecture Notes for CS 190
Winter 2018
John Ousterhout
- Reading: Chapter 12 of book
- Name choice has a significant impact on system complexity
- Goal: create an image in the mind of the reader
- Be precise and specific
- As much information as possible in a few words (but not too long)
- Be consistent:
- Always use the same variable name for the same kind of object
- Avoid using the same name to refer to different kinds of things
- Exception: very short names such as i OK for highly localized
usage
- Example: short loops.
- But, still be consistent!