Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of singular/plurals for compound terms #51

Open
octavian-nita opened this issue Mar 5, 2021 · 2 comments
Open

Use of singular/plurals for compound terms #51

octavian-nita opened this issue Mar 5, 2021 · 2 comments

Comments

@octavian-nita
Copy link

I'd suggest a convention regarding the use of singular/plurals if only I knew how to formulate it in English properly :) Hopefully, someone has a good English formulation to replace mine.

The idea is to pay attention to what noun in a (more-or-less) compound term we employ in plural form when naming things with multiple values. I.e., just as we use, say, documentTypes, I think we should most probably use childPaths instead of childrenPaths, etc.

I've seen this (i.e., using the plural form for all nouns in such composed term) happening a lot and I don't quite agree with it.

octavian-nita added a commit to octavian-nita/naming-cheatsheet that referenced this issue Mar 5, 2021
@kettanaito
Copy link
Owner

Hi, @octavian-nita. Thank you for this suggestion! I think you've formulated it beautifully.

Would this also apply to cases when multiple segments of the variable are changed to plurals while only the last (?) bit should be plural?

-postsLinks
+postLinks

@octavian-nita
Copy link
Author

Hi @kettanaito,

Indeed, I would say so, yes.

There may be situations where keeping several plurals might make sense, depending on what the developer wants to convey. In your example, I would understand "postLinks" as referring to the collection of links of a particular post, but someone else could use "postsLinks" to refer, for example, to all the links of all the posts. However, I would still not use "postsLinks" for that :). Instead, I would probably use "allPostLinks" or something else. Or another example would be when we have a map/dictionary that associates many entities, like posts and their links. There, we might use "postsLinks" for brevity, but I'd still make an effort to write "postsToLinks" or "postsAndLinks."

So yes, I generally favor only one word/segment in the plural form, and I'd recommend much care with several words in plural.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants