DEV Community

Discussion on: The 5 Commandments of Naming Variables

Collapse
claudioscatoli profile image
Claudio Scatoli • Edited on

About the II one, use plural nouns for array names:
I found that adding a "typifing" word of some sort to the name makes it even easier to read.

e.g.

  • foreignCountriesArray
  • foreignCountriesList
  • foreignCountriesCollection

I often fell that just adding the 's' is not "signaling" enough, especially when there's a variable that refers to one of the elements of that array

e.g.

  • foreignVillage (an elem of the array)
  • foreignVillages (the array)

What do you think about that?

Often it makes the code more verbose, but is it always bad? (IV rule)

Collapse
ctrleffive profile image
Chandu J S

I prefer foreignCountryList instead of foreignCountriesList because that is much readable.?