Should we put an S in the name of array of things?

179 Views Asked by At

It is more an English question than a Coding question, but both are related :

Should we put an S in the name of array of things ? I want to know if it is just an opinion question or if there is a real English rule.

How to name an array of that array ?


Example 1

I have an object named Constraint. I want to create an array of that object. How should I name it ? ConstraintsArray or ConstraintArray ?

Answer

Do not use Hungarian Notation. Call it Constraints.


Example 2

How to name an array of that array ?


Thank you for your answers.

4

There are 4 best solutions below

3
On BEST ANSWER

IMO, you should just call it "constraints", without the "array" prefix (referring the Clean code.. :) )

0
On

I think it really depends on the coder himself. No real rules on variable on Grammar. :) . for me I like using singular form eg. ConstraintArray...

0
On

ConstraintsArray seems redundant in meaning.

You can use ConstraintArray or just Constraints.

0
On

That is very much up to your personal style. I would not do it. A personArray is already a list of more than one person. You should know that.

But if the array objects are lists too it's a very different situation. Names like itemsDictionariesList, or repositoriesArray is something I used in my project.