3

A two-part question is two questions in one sentence. For example: "How to do this, and that?"

From the docs:

Needs more focus - If your question has many valid answers (but no way to determine which, if any, are correct), then it probably needs to be more focused to be successful in our format.

What appears when you flag:

This question currently includes multiple questions in one. It should focus on one problem only.

Examples include:

  1. How do I delete a Git branch locally and remotely?
  2. How do I push a new local branch to a remote Git repository and track it too?
  3. How do I make function decorators and chain them together?
  4. How to merge two arrays in JavaScript and de-duplicate items
  5. How does the "this" keyword work, and when should it be used?

There are obviously more questions, and these questions are very useful.

So, should similar questions be closed?

2
  • Humans have an unlimited capacity to rationalize.
    – philipxy
    Commented Mar 19, 2023 at 8:43
  • 4
    Note that "How to merge two arrays in JavaScript and de-duplicate items" is more than the sum of its parts. You can merge two arrays as one operation and you can de-duplicate as another but if your goal is to start with two arrays and end up with one which contains the unique members of each, then there are other approaches to take that take you there.
    – VLAZ
    Commented Mar 19, 2023 at 8:49

1 Answer 1

12

Several questions in a post are allowed if they are closely related. That is, if one question in many cases implies the other and vice versa, then focusing is not lost.

This criteria of "closely related questions" can be reformulated as: if a possible answer for the first question in most cases will answer the second question, and a possible answer to the second question in most cases will answer the first one, then the questions are closely related and can be asked in a single question post.


As example, below I advocate the question posts linked from that meta question. I perfectly aware that my understanding of these posts is not the only possible one, but at least it has some reasonings.

The post 1 demonstrates closely related questions: git branches are rarely used only locally, or only remotely.

The same is about post 2.

The post 5 also consists from closely related questions: meaning and usage comes together.

The post 3 actually is about a single problem: chaining the functions decorators. It could be not so evident from the initial post, but in the current form I could definitely say: it is chaining which bothers an asker.

The post 4 is about the single problem too: a sequence of merging and de-duplicating is just a way for describe the total desired effect.

6
  • 3
    Re post 3, it ended up becoming a general reference for how decorators work and how to write individual ones, both because OP didn't seem to demonstrate background understanding and because it attracted an encyclopedia-length answer. We really should do something about that, honestly. Commented Mar 19, 2023 at 9:42
  • @KarlKnechtel: Agree, that lengthy answer feels itself uncomfortable in Stack Overflow format and (funny) makes the question post unfocused. The second highly voted answer seems to better fit to "chaining problem".
    – Tsyvarev
    Commented Mar 19, 2023 at 10:01
  • I agree with most of this, but I disagree about post 4, since the steps to achieve this effect are clearly distinct. How to merge arrays is already answered here, and how to remove duplicates is already answered here. Since the answer is "do one, then the other", I think that question should be closed as a duplicate of the two other questions, since the answers are basically duplicating the content of the answers to the two other questions. Commented Mar 19, 2023 at 14:19
  • 2
    @DonaldDuck: "I disagree about post 4, since the steps to achieve this effect are clearly distinct" - I would argue about "clearly" aspect: as I am not SME, it seems logical for me to think about indivisible effect of combining arrays and removing their cross-duplicates. Well, the problem is that even such one-step purpose could sometimes not to have a one-step code. I agree that most of the answers differs only in "remove-dups" aspects and they just reiterate these aspects from stackoverflow.com/questions/9229645. So marking question as a duplicate has a sense...
    – Tsyvarev
    Commented Mar 19, 2023 at 15:05
  • ... but it also has a sense for the question to have its own answers. E.g. that answer prepares the "environment" for one-liner. Whether this intention good or bad (I see comments with downsides, but again, I am not SME in JavaScript), it deserves to be present on Stack Overflow.
    – Tsyvarev
    Commented Mar 19, 2023 at 15:10
  • 1
    @DonaldDuck "merge and deduplicate arrays" task is not a "merge arrays" -> "deduplicate arrays". It's one way to achieve this. Not the only way. You can stream the arrays as an iterator into a set which does the merge+deduplicate. Then convert the set to an array. This would be the easiest way to achieve the task. The closest thing you can do with the two steps you propose is merge the array then pass through a set then convert back to array. Which will take more processing and memory to be done.
    – VLAZ
    Commented Mar 19, 2023 at 16:51

You must log in to answer this question.

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