Function naming conventions [closed]

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:

  1. Self-explanatory names: a function getName() will tell the developer what it returns as well as setAddress(), isMale(), etc.
  2. 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.
  3. 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?


One of the more universal, yet simple rules is: Function names should be verbs if the function changes the state of the program, and nouns if they're used to return a certain value.


One more important thing to do when writing a library is to use the same word to describe the same action every time. don't write a function named getName in one class and another function named retrieveNumber in another class.