How to correctly write chains of nouns with plurals like "Messages List" and "Apple Count" for IT [duplicate]

Solution 1:

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.

Solution 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.