Code becomes easier to understand when names align closely with their meaning. Since classes represent things, they should use nouns. Methods, on the other hand, represent actions and should be named using verbs. A method named Person, for example, could easily confuse your team by suggesting an entity rather than an action.
What is a verb?
A verb is a word that describes an action or process—something that’s done. Examples include walk, run, think, listen, and breathe, as well as process, calculate, send, and save.
Naming methods as verbs
While your method names shouldn’t all be single verbs (since that’s often too vague), they should be verb-based, using a verb as the foundation of their meaning.
Using Ship
as a method to initiate shipping orders to customers.
Bad example - While 'ship' is a verb, it’s also a noun, making it ambiguous. Plus, it's not very descriptive!
Using SendCustomerOrder
Good example - A method that is named as a verb clearly tells you that it does something (sends), and what that thing is (a customer order)
Using Administration
as a method name for nurses to document medications that have been administered to patients.
Bad example - It’s a noun, and it’s ambiguous. 'Administration' has multiple meanings, and the method name doesn’t make it clear what this action involves
Using AdministerMedication
makes the action clear
Good example - Method name describes the action
- Do you use clear and meaningful names when coding?
- Do you use nouns for class names?
- Do you avoid generic names like “manager” or "helper"?
- Do you avoid micro-culture jargon and insider terms?
- Are you consistent with the words you use to represent concepts?
- Do you know when to use technical terms versus domain terms?
- Do you avoid using your name or your company’s name in client code?
- Do you use meaningful modifiers for custom implementations?
- Do you follow naming conventions for tests and test projects?
- Do you use clear and meaningful names when coding?
- Do you use nouns for class names?
- Do you avoid generic names like “manager” or "helper"?
- Do you avoid micro-culture jargon and insider terms?
- Are you consistent with the words you use to represent concepts?
- Do you know when to use technical terms versus domain terms?
- Do you avoid using your name or your company’s name in client code?
- Do you use meaningful modifiers for custom implementations?
- Do you follow naming conventions for tests and test projects?