Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plural/singular naming in methods returning lists

it seems a trivial point, until you realize that you need consistency. Not being a native English speaker, I prefer to ask both for grammar and for style. Which one must be preferred among these method names, returning a list of URIs, each one associated to an object?

objectUriList()
objectsUriList()
objectUrisList()
objectsUrisList()

Also, do you consider good style to make explicit that the returned object is a list in the method name. Maybe something like objectUris() (or its correct form) would be fine and intuitive in any case.

like image 571
Stefano Borini Avatar asked Dec 14 '09 08:12

Stefano Borini


2 Answers

I am not a native English speaker either. Correct form is either objectUriList or objectUris. Regardless of the number of objects and uris.

Car park = park of cars.
PC storage = storage of PCs.
oak forest
etc.

like image 174
yu_sha Avatar answered Jan 03 '23 07:01

yu_sha


I would call is objectUriList(), it's just easier to say and essentially correct. It's clear that it returns a List which is a set of Uris, so you don't really need the plural there.

However, your final suggestion of objectUris() is also good, depending on how easy it is to see that it returns a List in your IDE.

like image 28
Francis Upton IV Avatar answered Jan 03 '23 05:01

Francis Upton IV