8

Especially in IT it is often neccessary to write chains of nouns like "Messages List" because one cannot use "The list of messages" for variable name in a programming language. I can't understand how to construct them correctly for plurals, ex. "Message list" or "Messages list" ? What grammar rules concern this subject?

As a maybe special case, I'm interesting in naming the number of something, ex. the number of apples. It is common to use "apple count" (altough 'count' means counting, not quantity). What is right, "apple count" or "apples count", and why?

I found a little bit similar question. Maybe both forms are allowed?

6

Using the plural would be odd, if not outright wrong.

  • A list of messages is a message list, not a messages list.
  • A trap for mice is a mouse trap, not a mice trap.
  • A catcher of flies is a flycatcher, not a fliescatcher.
  • Determination of types of compound nouns is compound noun type determination, not compound nouns types determination.
2

There are plenty of discussions about this topic already, which could be considered a grey area between English and programming, I guess.

As an English-speaking programmer, I'd suggest that such names would generally contain singular nouns, such as messageList and appleCount in your case (capitalisation is a whole other issue and possibly a massive can of worms!)

The general idea behind naming things in this way is so that other people (and you in the future) can understand what's going on at a glance. I've had to work with C++ code with single-letter variable names (ostensibly chosen for compiler efficiency) and it's not pleasant.

So as long as the code is clear, then I'm not sure it matters too much. You could actually have theListOfMessages, but you're going to be typing more and could 'clutter' the code. Try to keep them short and meaningful. If you're doing this professionally, your employer may well have their own guidelines which could indeed contradict some of my comments above.

  • 1
    Although incorrect , I have used "merchandises" in my code, just to imply that it is a one to many relationship. My coworkers have found it helpful. I suspect this question will be marked irrelevant but that's my two cents for you. – hungryKoala Feb 19 '15 at 18:43
  • @Ritu : That's a good point. Languages like Ruby actively encourage this convention, I believe. (I've never used it). – Robin Williams Feb 19 '15 at 18:53
  • I think this answers a different question. – reinierpost Dec 11 '15 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.