What is a good naming convention for arrays? I am working on a code base with few thousand line of codes and there is no consistent naming convention for arrays. Few ppl name them by appending List at the end of the name like *message_list*, which I really dont like as it wrongly suggests that this is a list(linked list), and few people name them by appending 's' at the end like messages which is better than previous approach but sometimes fails.
I want to know if there are any naming conventions out there for array type variables?
Name them for what they hold. An array of messages should be called messages
. An array of file names should be called filenames
. Capitalize to suit your whims and prejudices.
There are those who argue for the singular, suggesting that message[i]
is singular and better than messages[i]
. There is some justice in that, but the counter-argument is that the variable names an aggregate, so the plural is better.
I'd not use a suffix such as _list
for an array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With