Search code examples
coding-stylenaming-conventions

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.


Solution

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