Course contentsShow
← Java
Lesson 204 of 2,8705. Methods and Function CallsFree lesson

Method Naming Conventions: Verbs and Clarity

Follow Java conventions for method names using verbs and achieving self-documenting code.

Method Naming Conventions: Verbs and Clarity

What you'll learn: How to name methods in Java following professional conventions that make your code instantly understandable.

The Power of a Good Name

Method names in Java should clearly communicate what action the method performs. Unlike variables (which are typically nouns describing things), method names should start with verbs because methods do something. Think of methods as commands you're giving to your program: "calculate this," "print that," "find something."

The Verb-First Rule

Start your method names with action words:

  • calculateTotal() — immediately clear it performs a calculation
  • printReport() — obviously outputs a report
  • findMaxValue() — searches for the maximum
  • isValidInput() — checks validity (returns boolean)
  • getUserName() — retrieves user information

Bad examples that violate this convention:

  • total() — what about the total? Calculate it? Return it?
  • report() — is this a noun or verb? Confusing!
  • valid() — checking or making something valid?

Clarity Over Brevity

Your method name should be self-documenting. Someone reading calculateMonthlyInterestRate() knows exactly what happens without reading the code inside. While calcInt() is shorter, it's cryptic and unprofessional.

Use camelCase: first word lowercase, subsequent words capitalized (getUserInput, not getuserinput or get_user_input).

Common Verb Patterns

  • get/set: retrieve or modify values
  • is/has: boolean checks (isComplete(), hasPermission())
  • calculate/compute: perform calculations
  • find/search: locate data
  • validate/check: verify conditions
  • print/display: output information

Key Takeaway: Name methods with verb phrases that clearly describe their action, making your code readable as plain English without requiring comments.