6

Quite often I find myself referring in text to objects which have strict naming conventions e.g. Java objects, processes, services. I find myself in a dilemma over how to pluralize these names.

It seems wrong to pollute the meaningful name by adding an 's' - or worse, a plural that modifies the rest of the name like SomethingUtility -> SomethingUtilities. What if someone does a text search looking for the name? Or cuts and pastes from my comment to search through a log file?

I have sometimes resorted to an ungrammatical apostrophe, but this can confuse plural with ownership.

Is there any better solution?

| improve this question | | | | |
  • 4
    Is that really a problem ? – Tulains Córdova Aug 7 '13 at 9:38
  • enough of a problem that 3 people found an answer useful... – Graham Griffiths Aug 7 '13 at 9:45
  • Just to clarify your question, your issue is with documentation only? – zuiqo Aug 7 '13 at 12:24
  • 1
    @phi - not just documentation, but any time I have to refer to these objects in text, e.g. notes, messages, code comments...even on Stack Overflow – Graham Griffiths Aug 7 '13 at 12:55
7

If the class name cannot be converted into proper English, while retaining it's sense, then that's usually indicative of bad class naming. That is, if you're talking about a ShippingMethodRepository, then there's rarely a reason not to write "shipping-method repository" and thus "shipping-method repositories". This is easier for most people to read, because of the subtle visual clues in compound modifiers and such.

In the few cases where you feel a need to point to the class-name, if you give each situation some thought, you'll probably find that you're missing either the word "instance" or "class" in your sentence. I suggest putting it back in as a matter of course -- it is easy to cause confusion by not being specific.

As a bonus, this will make it easier to pluralise. ie. "ShippingMethodRepository instance" becomes "ShippingMethodRepository instances". (You'll probably find that you never need to pluralise class in this context.)

| improve this answer | | | | |
5

In my Documentations, I do it like we do it here on Stackexchange and use different font Styles for special Terms.

For those terms where a different pluralization would be required according to English grammar, I just don't do it. My excuse for this is that the names of my Classs are not English words. They are a made-up words for my program.

| improve this answer | | | | |
  • -1 for not actually answering his question about 'SomethingUtility''s – DougM Aug 7 '13 at 12:39
  • @DougM Updated answer. – Philipp Aug 7 '13 at 20:21
  • 1
    "Classs"? Really? Can't say I agree with that :P I do agree with the overall advice, though. – Andres F. Aug 7 '13 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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