Good Programming Naming Conventions

  • Start with a verb for functions that do not return a boolean, e.g. refresh_cache(), get_address(), insert()
    • for functions that return a boolean, start the name with is if possible, e.g. is_empty()
  • Name parameters using natural language, e.g, insert(at=1)
  • Being consistent when naming similar functionalities, e.g. list.add(), set.add()
  • Use natural language instead of one character variable name (unless it is a math formula), e.g. each = getEnumeration(), instead of e = ...
    • it is common to use i in a for-loop and x,y for coordinates, e for exceptions
  • Limit identifier names to 20 characters
  • Include units in a name, e.g. distanceInCentimeters, elapsedTimeInDdays
  • Class and object names should be a noun, e.g. Customer, WikiPage
  • If a variable name is used multiple times, it should be searchable (avoid using single characters)
  • Functions should only do one thing, thus their names should reflect that (instead of being ambiguous)

For Python:

  • Avoid dashes in any package/module name
  • avoid __double_leading_and_trailing_underscore__ names 

Recommended naming conventions for Python: