Words are pronounceable.
Your names should be too.
Try to tell your team about your
new method: imgrgbToBwNoFtr21v1()
You will be pressing double Shift
many times in your career.
Create easy to find names.
How many search results have variables called „a” or
„oo”?
Use Intension-Revealing Names
One-character names should be avoided
except for local, temporary variables.
Class names should be nouns
PascalCase with first letter of a word capitalized
Use whole words and avoid abbreviations.
Source: Oracle.com
Method names should be verbs
Use camelCase with first letter lowercase
Source: Oracle.com
Avoid disinformation
Too long names could introduce a chaos in code.
Avoid too long names.
Avoid adding type to name
It’s like adding „human” to your friend’s name
firstNameString is like AnnHuman
lowerCamelCase -> variables and methods
upper camel case (PascalCase) -> enums, classes and
interfaces.
For separating words in the database object
name, use underscore snake_case
INTEREST_RATE (screaming snake case) ->
constants
Avoid names with double letters
They can be easily misspelled
balloon dumbbell embarrass millennium misspell occurrence possession
questionnaire aggressiveness Committee Bookkeeper Addressee possessiveness
Coming in second is
just one meaning of the
word. Time and place.
Avoid using diffrent words for the same purpose
discoverElementById, detectElementById, checkElementById, obtainElementById,
receiveElementById
-> findById
generateElement, createNewElement, produceElement, makeElement, manufactureElement,
buildElement, constructElement
-> createElement
To code, or not to code,
that’s is the question

Write code like Hamlet! 15 golden rules for names in programming

  • 2.
    Words are pronounceable. Yournames should be too. Try to tell your team about your new method: imgrgbToBwNoFtr21v1()
  • 3.
    You will bepressing double Shift many times in your career. Create easy to find names. How many search results have variables called „a” or „oo”?
  • 4.
  • 5.
    One-character names shouldbe avoided except for local, temporary variables.
  • 6.
    Class names shouldbe nouns PascalCase with first letter of a word capitalized Use whole words and avoid abbreviations. Source: Oracle.com
  • 7.
    Method names shouldbe verbs Use camelCase with first letter lowercase Source: Oracle.com
  • 8.
  • 9.
    Too long namescould introduce a chaos in code. Avoid too long names.
  • 11.
    Avoid adding typeto name It’s like adding „human” to your friend’s name firstNameString is like AnnHuman
  • 12.
    lowerCamelCase -> variablesand methods upper camel case (PascalCase) -> enums, classes and interfaces.
  • 13.
    For separating wordsin the database object name, use underscore snake_case INTEREST_RATE (screaming snake case) -> constants
  • 14.
    Avoid names withdouble letters They can be easily misspelled balloon dumbbell embarrass millennium misspell occurrence possession questionnaire aggressiveness Committee Bookkeeper Addressee possessiveness
  • 15.
    Coming in secondis just one meaning of the word. Time and place.
  • 16.
    Avoid using diffrentwords for the same purpose discoverElementById, detectElementById, checkElementById, obtainElementById, receiveElementById -> findById generateElement, createNewElement, produceElement, makeElement, manufactureElement, buildElement, constructElement -> createElement
  • 18.
    To code, ornot to code, that’s is the question