10

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.

2
  • Why have object on there? It is redundant overall. Is there a reason for it over uriList()? URI <=> object Dec 14, 2009 at 8:40
  • yes. I actually have multiple objects I provide a routine for. My use of the word object in the question is just a placeholder for my real cases. Dec 14, 2009 at 8:42

7 Answers 7

8

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.

0
4

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.

3
  • Ok, not really programming related, but this means that in English you pluralize only the last of a set of chained names. I always forget this rule. Dec 14, 2009 at 8:30
  • 2
    Being a native English speaker, I have no idea what the rules are, it just sounded right. :) Dec 14, 2009 at 8:36
  • 1
    Yup, I also go "by sound", but sometimes I have doubts... in particular because in Italian it's different, we pluralize everything. Dec 14, 2009 at 8:41
2

objectUriList should be the correct answer. (Unless the function runs on more than one object and then objectsUriList would be preferable).

I like to specify the returned object in the function name but because this is how I worked for my entire life (ever since crappier programming languages). Nowadays, I believe it's not necessary.

2
  • 1
    And look the first three answers agree! Dec 14, 2009 at 8:30
  • Would agree with this! And many languages (that support generic types), the plural can even be removed and defined: objectUriList<object>
    – tfont
    Apr 11, 2023 at 14:01
1

It's better to use ObjectUriList.

It is recommended in some circles not to include type names in member/parameter names, so you should drop the List part, but I find that "ObjectUriList" is much more explicit and meaningful than "ObjectUris", especially when you are likely to also have "ObjectUri" as a name nearby.

1

I would definitely go with the objectUris() alternative, omitting the "List" suffix. As you say, tidy and intuitive.

1
  • Beg to differ regarding intutiveness. objectUris() could have a return type of string[] or a List<URI>. objectURIList() tells me that the return type is a List<>. But yes, since we all use an IDE of some sort, you may be right after all. Oct 24, 2014 at 6:11
0

I think to differentiate between Array and List, It's good to append Array with 's' and List with 'list'.

0

I usually try to go with singular namespaces but sometimes and contextually plural namespaces as well. For e.g. if your return is always plural such as some keywords, I go with plural but if it can be singular often times, I stick to singular naming convention.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.