Search code examples
naming-conventionsnamingnon-englishplural

Plural naming convention for composite objects


The question is about the correct way to name variable or identifiers that groups collections of two or more "things". Let me explain a little further with example and question...

  • If you something that holds an id you may name it with the identifier "id"
  • If you got somethign that holds an appoinment you may name it "appointment" as identifier
  • If you got multiples ids (for example, an array) you may name it "ids"
  • If you got multiples appointments under an array you may name it "appointments"
  • If you got multiples appointments' ids, how may i name it?
    • appointmentIds?
    • appointmentsIds?

I'm not an english native speaker.


Solution

  • In your example you'd name it "appointmentIds", as it's multiple Ids for your appointment type i.e. Ids for many different appointments.

    "appointmentsIds" would imply the relationship between an appointment and its Ids i.e. the appointment (singular) has many different Ids, which from your example is not likely! I'd suggest reading up on nouns and the possesive (I appreciate English is not your first language, English is hard!)