correct variable name

mrrevenge

New Member
Polish - Poland
If I have list of many orders with many items - the correct name for variable should be: ordersItems or orderItems?
 
  • srk

    Senior Member
    English - US
    Of course you can name a program variable anything you like. In plain English you would use the term "order items," not "orders item." That makes "orderitems" or "order_items" a good choice.
     

    Edinburgher

    Senior Member
    German/English bilingual
    There is nothing special about orders here. It follows the usual convention in English that (because adjectives do not have a plural form) when nouns are used in the role of adjective, they are not pluralized.
    For example, the kingdom of animals is the animal kingdom, not the animals kingdom, the population of students is the student population, not the students population, and when, on the day before men get married, they go out and get drunk with their friends, these are called a stag nights, not a stags nights.
     

    dojibear

    Senior Member
    English - Northeast US
    If I have list of many orders with many items - the correct name for variable should be: ordersItems or orderItems?
    You have a list of many orders. Each order contains many items. So you have a list of lists.

    What programming language are you using? Some high-level languages allow list elements to be lists. Is that what you are doing? Or is it a 2-dimensional array?

    If each element in the array (array[j][k]) is "one item on one order", then "orderItem" is the best array name: processItem(orderItem[j][k], storeNumber);

    If this is a single non-array variable that will hold (one at a time) "one item on one order" then "orderItem" is a good name for that too.
     

    Edinburgher

    Senior Member
    German/English bilingual
    That's a good point. The name of an array or list variable would generally be singular. The integer variable telling you how many items there are would be more likely to have a plural name.
     

    mrrevenge

    New Member
    Polish - Poland
    If I have:
    - list of many orders with many items
    - list of items only one order

    then in English the name should be the same "order items". Double plurar nouns like "orders items" aren't correct in English?
     

    Uncle Jack

    Senior Member
    British English
    If I have:
    - list of many orders with many items
    - list of items only one order

    then in English the name should be the same "order items". Double plurar nouns like "orders items" aren't correct in English?
    "Order items" can refer to items from one order or items from many orders. In itself, it does not mean a list, but the items themselves. Each item is an "order item". A list of order items could be an "order item list".
     

    mrrevenge

    New Member
    Polish - Poland
    "Order items" can refer to items from one order or items from many orders. In itself, it does not mean a list, but the items themselves. Each item is an "order item". A list of order items could be an "order item list".
    If you're asking Are double plural nouns not correct in English? then the answer is "No, they're not correct."
    Thx :) In Polish language we have "order items" for items from one order and something like "orders items" for items from many orders. :)
     

    AnythingGoes

    Senior Member
    English - USA (Midwest/Appalachia)
    Thx :) In Polish language we have "order items" for items from one order and something like "orders items" for items from many orders. :)
    Many Indo-European languages work like that, but English isn't one of them. I've noticed that this is a common source of error among learners. The error is unlikely to impeded comprehension but of course you should try to master the rule that in English, adjectives are invariable.
     
    < Previous | Next >
    Top