10

The backtick is used on many sites of Stack Exchange to format inline text as code.

How do I pluralise words when they refer to code? Let's say I have some item in my code called "ToolBarButton". Which way of doing it is best practice? I have come across the following two:

  1. ToolBarButtons - seems like the "right" way to do it, but looks ugly and decreases readability.
  2. ToolBarButtons - easier to read, but it suggests that an element exists which is called exactly "ToolBarButtons", which is simply not true.
  3. ToolBarButtons - not formatted at all. But then the camel case looks weird if it's not marked as code.

Sample:

I have 10 ToolBarButtons on my Form and I had like to be able to iterate over them all at once without the need to call Find on the Form. How do I do that?

5
  • Well, you still don't have to use backticks around this all thing, as it's not really code. You can write "All the buttons of type ToolBarButton". Commented Sep 25, 2017 at 11:26
  • 1
    I added a sample for you as I regularly see it on Stack Overflow. Feel free to revert if you don't like it. Commented Sep 25, 2017 at 11:31
  • @ShaWizDowArd I find it difficult to justify the convoluted way of using an objects plural every time I talk about it
    – Neuron
    Commented Sep 25, 2017 at 11:34
  • While its not a technical answer (and the exact term is likely to be corrected) I'd go I have 10 instances of ToolBarButton Commented Sep 25, 2017 at 14:27
  • Since it is a name of a type I would maybe go: I have 10 "ToolBarButton"s ... because it's also not really code but I guess there are many ways and opinions how to do it
    – derHugo
    Commented Oct 2, 2017 at 4:52

1 Answer 1

8

I think there is no right or wrong here. For me, all options have their pros and cons and I really don't know which one is better than the other.

Personally I prefer "ToolbarButtons", to stay with your sample.

You want to make clear it is a class name (so code formatting is fine here in my opinion). "ToolBarButtons" is wrong here since it is technically incorrect. "ToolBarButtons" will be confusing at times since it might be unclear if it is a word or a mini-code snippet (like in "apples" vs. "apples").

The formatting just looks ugly, that's all. If that is the only problem, maybe the SE team can work on that.

1
  • 2
    I sometimes use "foo instances" where appropriate to dodge the formatting issues, but have the same preference when that doesn't work
    – Tim Stone
    Commented Sep 25, 2017 at 11:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .