12

My by far highest voted contribution to the SE universe is my answer to How to use Android quantity strings (plurals)?. I am glad to see it helps a lot of people.

Nevertheless I'm not really happy with the current state of my answer. While it does a good job of explaining what you have to do (essentially "pass the quantity variable twice"), it lacks the explanation why you have to do it, i.e. explaining the quantity parameter of the getQuantityString method. Adding this explanation would mean explaining the relation between the quantity attribute in the XML resources and that quantity parameter.

I've been tempted to edit the answer and provide that kind of context to it, teaching about this whole quantity concept in general. But so far I've been reluctant, since the current state of the answer seems to be "good enough" according to the votes.

My considerations are these:

On one hand, the added context might help the reader to understand the underlying concept of "Quantity strings in Android" better. Understanding this would likely also help them to avoid the most common pitfall, namely assuming that an entry for quantity="zero" in the resources would be displayed if the quantity value passed to getQuantityString was 0. I think almost every programmer stumbles across this "oddness" sooner or later when working with Android quantity strings.

On the other hand, people might have found the question by googling the error message from the question, to which the added context has a very vague relation at best.

Furthermore, the context alone would also be a good answer to a completely different question "Why is quantity="zero" never used?".

But then again, it's also common to search for "How to use" when trying to get started with a completely new topic. Finding this question, and having the answer cover the concept in a more holistic fashion (including special cases like "What if I have two quantities" from the comments) means they can learn everything I think they need to know to have a solid basic understanding of the whole topic at hand.

So I'm really unsure whether or not it's a good idea to edit the answer and put more information about the "plurals" concept in.

5
  • 8
    You could edit the answer, adding a horizontal rule (--- in Markdown), and add a section explaining the concept, maybe using a header (### for <h3> in Markdown) to announce the change in focus. Commented May 29, 2021 at 0:02
  • That would be my suggestion as well. Add a new section, and include the new material in the new section. That allows you to preserve the original answer, while giving you the freedom to embellish. Commented May 29, 2021 at 2:01
  • 1
    Not an expert, but I believe there could be an already duplicate of "why is quantity zero", find it and simply reference in your answer. If answers there are not good enough, then post what you want to add as a new answer there.
    – Sinatr
    Commented May 31, 2021 at 7:11
  • Go for brief additional background explanations but don't write a book. If possible reference other questions containing additional knowledge, maybe even write your own Q&A pair and reference to it if needed. Surely there is a trade-off where the usefulness is biggest. Clearly separate the direct solution from the discussion and the context. Commented May 31, 2021 at 11:04
  • I did exactly what Heretic Monkey suggested in my top answer, and the people who read my answer after my edits seem to appreciate the addendum, as I got more upvotes since I made the edit than before. So based on this limited experience, I would say such a change is appreciated by visitors of this site.
    – Laf
    Commented May 31, 2021 at 18:59

1 Answer 1

14

Explain or not explain?

It is always better to also explain why you need to do something instead of just explaining how to do it.

If you just tell them how to fix something, they may use the fix, but they can run into similar problems because they don't fully understand it.

If you give sufficient context, readers can really understand the problem and everything necessary around it and if they run into similar problems, they may be able to fix them by themselves.

It is always better to understand something than just knowing how do do it without understanding anything.

Edit if others seem to like it?

If you think it makes the answer better, edit it.

By adding more context, you clearly make the answer better. Especially, if you add the context after the solution that would suffice for that specific problem and clearly differentiate between the sections.

As Heretic Monkey mentioned in the comments, you can use Markdown formatting to separate the quick solution and the explanation.

You could edit the answer, adding a horizontal rule (--- in Markdown), and add a section explaining the concept, maybe using a header (### for <h3> in Markdown) to announce the change in focus.

If someone just wants a working solution, they can just read the first part and if they are interested a more detailed explanation, they can also read the second part.

Considering this, I would recommend you edit the question to add an explanation, but clearly split the direct solution and the explanation.

1
  • Thank you, I went ahead and added all the extra information that was on my mind.
    – LWChris
    Commented May 29, 2021 at 15:45

You must log in to answer this question.

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