Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Naming convention list when objects ends with "s"

A normal list can be called like this (this is what I learned at school):

List<Object> objects = new List<Object>();

But, how does a list has to be called when the object itselfs ends with a "s".

List<Octopus> octopuss = new List<Octopus>();
List<Boss> bosss = new List<Boss>(); 

It seems wierd to add another s. Not many (single) words end with "s". So, this is one of the first time I encountered it. Did anyone found a source where this is explained?

EDIT

These words have a plural noun. But what about these:

List<Series> series? = new List<Series>();
List<Species> species? = new List<Species>();
like image 613
LangeTreeDorpie Avatar asked May 21 '26 19:05

LangeTreeDorpie


1 Answers

Basic Plurals

For variables that contain multiple items, it's best to use basic english plurals:

  • object -> objects

  • disk -> disks

With words ending with 's':

  • boss -> bosses

  • octopus -> octopi OR octopuses

With zero plural nouns (words that are the same in singular and plural):

This is where it gets more difficult. You could choose to adopt a separate name for plural and singular like:

  • sheep -> flock

You could simply add an 's' or 'es' anyway (not proper english, but may be more clear in code):

  • series -> serieses

  • species -> specieses

  • sheep -> sheeps

You could choose to adopt a standard, like adding Coll or similar to the end of the name:

  • series -> seriesColl

  • species -> speciesList

  • sheep -> sheepSet

Refer: https://www.grammarly.com/blog/plural-nouns/

like image 191
Bilal Siddiqui Avatar answered May 23 '26 09:05

Bilal Siddiqui



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!