0

A collection like in:

  • A list of users
  • A group of cities

When attaching this as we do in software development to name variables, should it be named

  • userList vs usersList
  • cityGroup vs citiesGroup

which one is syntactically more correct?

luso
  • 111
  • I'm not sure that variable naming is required (or should be required) to follow English language rules, e.g. camel casing isn't syntactically correct in English. – KillingTime Jan 10 '20 at 08:56
  • well, that was only to set the context of the question – luso Jan 10 '20 at 09:11
  • The first question needs basic research, and if this was found to provide an inadequate answer would be suitable for ELL. The second question is a duplicate of When are attributive nouns plural {in form?}. – Edwin Ashworth Jan 10 '20 at 11:16
  • This is an issue of convention for development, not proper English. If you look at Airbnb's style guide (e.g., https://guide.meteor.com/code-style.html), you'd normally call a list a plural thing all by itself. So a "list of users" would be "Users" not "userList" or "userList". In javascript, you can say idiomatic things then like Users.forEach(user=>user.blunk). This is more of a question to ask on programming.SE, where the answers will be relevant. – jimm101 Jan 11 '20 at 02:29
  • 2
    I'm voting to close this question as off-topic because it should be migrated to programming.SE. – jimm101 Jan 11 '20 at 02:29

1 Answers1

3

You are correct that the plural is used in phrases such as "a list of users". However, your variable-names copy a different sort of phrase in English. This is where a noun (the head noun) is modified by a noun coming before the head noun. In this case the modifier is generally in the singular(1). Thus we would write "user list", and thus the variable-name would be better as userList.

(1) There are exceptions, such as "jeans pocket", but in those cases the modifier is a noun which is not normally used in the singular. Your examples are not of this exceptional type.

Rosie F
  • 5,009
  • Yes. A "collector of stamps" is a "stamp collector". And his/her pride and joy is their "stamp collection". And the missing object might be either in my "jeans pocket" or my "coat pocket". – WS2 Jan 10 '20 at 10:46