3

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.

Victor
  • 3,348
  • 2
  • 29
  • 55
  • i try to attach to one of 2 and be consistent across the source files (regardless in correctness in grammar sense).. but sometimes my mind autoswitch for one convention to other... and is not only me, often in the projects there are several with the same " issue".. so... any recommendation would be appreaciated. – Victor Apr 14 '20 at 15:45

1 Answers1

3

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!)

Ben Smith
  • 16,081
  • 5
  • 55
  • 79
  • 1
    "appointmentIds" would be then; and is much way better than "idsFromDistinctsAppointments" :D, i have to study further... thanks!! – Victor Apr 15 '20 at 15:31