Answer the question
In order to leave comments, you need to log in
What is the best way to name variables?
How to correctly name variables that end with the word List containing an array of objects. Should the first word (entity name || object class) be plural or singular? For example: productsList, ordersList, usersList
or productList, orderList, userList
?
Answer the question
In order to leave comments, you need to log in
Second: productList, orderList, userList
Or: products, orders, users
In general, this does not apply to programming - as far as I know, item list is correct in English, but list of items.
First of all, it should be clear to you and the programmer who will deal with it after you.
It makes sense to me that productsList will contain a list of products. Accordingly, the product is not one - the plural.
It is clear that it would be correct to say List of products, but such a variable is so-so :-)
And I would suggest Hungarian notation: lstProducts.
Or (there are examples from Haskell) List can be abbreviated to one letter: productsL.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question