Method Parameter Naming

When naming the parameters of a method you can apply almost the same rules as with the methods themselves. The difference here is that it is good for the names of the parameters to use a noun or a couple of an adjective and a noun, and when naming the parameters we use the lowerCamelCase convention, i.e. each word except for the first one starts with uppercase. We should note that it is good practice that the name of the parameter shows what unitis used when working with it.

A few examples for correctly named parameters:

  • firstName
  • report
  • speedKmH
  • usersList
  • fontSizeInPixels
  • font

A few examples for incorrectly named parameters:

  • p
  • p1
  • p2
  • populate
  • LastName
  • last_name

results matching ""

    No results matching ""