It's a language agnostic question. Seems like a common problem, but I can't find answer anywhere.

I need to pick a name for a variable to hold the values of one attribute of a list of objects, and I would like the variable's name contain the attribute name as well as the object's name. My question is how to use the plural forms correctly within the variable name.

For example, for storing the names of some companies from a list, imagine some pseudo code like this:

string[] x = companies.map(p => p.name);
// or
string[] x = companies.select(p => p.name);
// or
string[] x = companies.getNames();

And the question is: what should be the name of x array?

a) companiesNames - (two plurals)

b) companiesName - (plural + singular)

c) companyNames - (singular + plural)

  • 3
    People are voting to close the topic because of two things: first, the question is essentially asking which of the three choices states is grammatically sound, which makes it more of an English or ELL.SE question than an SE.SE question. Second, grammar aside, there isn't really a correct way to approach this, as while most people would use C, some would use A or B. It's a matter of preference, which makes the question highly opinionated and in turn off-topic for SE.SE.
    – Revenant
    Commented Mar 23, 2017 at 7:25
  • 1
    Picking a specific name for a variable is IMHO too opinionated for this site. But if you can reword the question in a more general fashion and clarify your "company" "name" is just an example for the more general type of problem, you might improve the chances of this question not to be closed (but I cannot give you a warranty on this).
    – Doc Brown
    Commented Mar 23, 2017 at 7:43
  • 1
    I disagree that this is opinion-based. A list of names of companies would almost certainly be spoken of as "the list of company names", and not as the *"list of companies names" or the *"list of company name". Therefore the variable should be named like this as well. Commented Mar 23, 2017 at 8:07
  • 3
    PS. For some commenters it might not be obvious that most programmers aren't native English speakers. So for them (and me) it's difficult to say which form "sounds" better is or more correct grammatically. In Polish language two plurals sounds better. In English it's otherwise.
    – andrew.fox
    Commented Mar 23, 2017 at 8:42
  • 2
    @Revenant This is a very important question, especially for people who are not English natives. It is not a matter of preference, but an important discussion on naming standards. An English language discussion form won't be aware of the engineering context. Here is the place to discuss it.
    – gipouf
    Commented Oct 14, 2020 at 14:11

2 Answers 2


Variable names should be grammatically correct (and spelled correctly), unless you have a compelling reason to do otherwise. So companyNames.

I you are in doubt, just think about what you would write in prose, eg, in an explanatory comment. "x is a list of company names" or "x is a list of names of companies" - but (hopefully) not "x is a list of companies names".

You probably get companiesNames and companiesName because you think of how the data is generated from a variable called companies. But when naming variables you shouldn't base it on how you got the value, but rater the meaning of the value itself.

  • I think companiesNames is actually an attempt to emphasize, that the names belong to many companies, and to distinguish from the the case of a single company having many names. This form (two plurals) is perfectly correct in Russian (and probably Polish, OP's language). But since in code we usually speak English, which seems to not allow this form, then we should either deal with the ambiguity, or switch to different name structure, like namesOfCompanies and then deal with its greater length.
    – Alex Che
    Commented Sep 2, 2021 at 11:24
  • (Actually, in Russian the form which allows two plurals is more close to the English form smth-of-smth, which also allows two plurals, so the languages are on par in this regard.)
    – Alex Che
    Commented Sep 2, 2021 at 12:17

To offer an alternative, add Of to make the matter a little clearer:

CompanyID => A unique immutable identifier for a single company

CompanyIDs => A list of the above

NamesOfCompany => A list of the trading names, current &/or historic, of a single company.

NamesOfCompanies => A list of the above lists of names of several companies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.