How do I choose a function name?

How do I choose a function name?

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. Another thing to keep in mind is consistency.

How do I name my class?

Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Try to keep your class names simple and descriptive. Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML).

How do you name things?

10 Tips for Product Naming Success

  1. Be Descriptive.
  2. Use Real Words with a Twist.
  3. Add a Prefix or Suffix.
  4. Create a Compound Word.
  5. Make up a Word.
  6. Change Spellings.
  7. Tweak and Blend Words.
  8. Use a Place or Person’s Name.

Why are the names of the functions important?

So let’s start with small steps. The current article covers the functions/methods naming good habits. Functions are the moving parts of the application, so having named them precisely increases the readability. The scope is to understand what the function does from its name, arguments list and the way it is invoked.

Can a function have more than one name?

Not only does this keep the enclosing function small, but it also adds documentary value because the function called within the block can have a nicely descriptive name. This also implies that functions should not be large enough to hold nested structures. Therefore, the indent level of a function should not be greater than one or two.

Do you use the same word for every function in a library?

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.

When to use a verb or noun in a function name?

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.