I am writing a library, so, I want its functions to be named as clearly and cleverly as possible. Currently, I use the following principles:
- Self-explanatory names: a function getName() will tell the developer what it returns as well as setAddress(), isMale(), etc.
- Short: a function name must be as short as possible so that it's simple to type as well as easy to remember. A function getNumberOfPagesInTheBook() is not good, something like getBookPageCount() is better.
- Use of prefixes: I always use prefixes in the functions such as getName(), setName(), hasHair(), isBlond(), etc.
I'm interested in knowing if there's something I'm missing. Also, can you think of some other prefixes other than is, has, get and set?