14

I've looked at the simliar questions; but I can't find a duplicate of this.

There is a question How to remove multiple object in List by id C#.

It is being suggested that this should be marked as a duplicate of c# - How to remove item from list? (i.e. remove one item)

These scenarios seem to me to be distinct. Where removing a single item, I would use the approach in the accepted answer for the second question. Where removing multiple items, I would use the accepted answer for the first question.

The help center states:

The fundamental goal of closing duplicate questions is to help people find the right answer by getting all of those answers in one place.

But I contend these questions are different. The accepted answers are different because the scenario is different, so I would not have expected these to be considered duplicates. The fact that one of the non-accepted answers to the second question mentioned that you could do it the way mentioned in the accepted answer of the first seems pretty tenuous, and I'm not sure marking it as a duplicate would help anyone. But maybe I'm misunderstanding.

8
  • 13
    A duplicate is only a duplicate when all possible answers to question A also apply to question B. That's not the case here. I also want to add that close-voting a question and at the same time answering it is a really wrong practice.
    – BDL
    Commented Nov 28, 2018 at 10:10
  • 5
    In XPath and XSLT land we get an awful lot of questions of the form "I have no idea why this isn't working" to which the answer turns out to be "because you have a default namespace in your document". These people all have the same problem, but they express it in very different ways, and there's no chance that they will find the answer by searching because they have no idea that the problem is something to do with namespaces. So closing as a duplicate really doesn't help people find the right answer. Commented Nov 28, 2018 at 17:11
  • 1
    Recently I've had two questions closed as a Dup sometime between when I started an answer and when I pressed submit. In both cases, though the questions and answers were related, the answers in the referred question didn't really address the question being closed. Perhaps SO could establish a bidirectional relationship between similar questions. This way, the new question can get an answer, but future searchers see the path to the related question as well. Similarly, someone who finds the related question could get referred to the new one.
    – Flydog57
    Commented Nov 28, 2018 at 19:19
  • @MichaelKay I blame that on lack of debugging.
    – Braiam
    Commented Nov 29, 2018 at 13:32
  • @Braiam I blame it on people writing code without first reading a tutorial on the language. Debugging XPath expressions that return nothing is actually difficult even for experts, and the only way to do it, really, is to have a thorough understanding of the spec - which an awful lot of XPath users don't have. Commented Nov 29, 2018 at 14:12
  • @MichaelKay Reading a tutorial doesn't guarantee that you would be able to debug a program. Rather knowing that you don't know (meta-cognition) is more important. That's why lack of debugging is my reason for not having idea. They have no idea they need to do debugging.
    – Braiam
    Commented Nov 29, 2018 at 14:14
  • 1
    @Briaim Reading a tutorial will alert you to the fact that namespaces have a deep significance in the processing model, whereas otherwise there's a tendency to dismiss them as meaningless noise. Then when things don't work, it's just possible you will think of namespaces as a possible cause. Commented Nov 29, 2018 at 16:48
  • @MichaelKay again, tutorial doesn't guarantee that you will achieve that knowledge. Heck, if the tutorial is bad enough, it is preferable that no one read it instead. Wrong knowledge is worse than no knowledge, since the first give the illusion of having knowledge at all.
    – Braiam
    Commented Nov 30, 2018 at 11:34

4 Answers 4

9

But I contend these questions are different. The accepted answers are different because the scenario is different, so I would not have expected these to be considered duplicates. The fact that one of the non-accepted answers to the second question mentioned that you could do it the way mentioned in the accepted answer of the first seems pretty tenuous, and I'm not sure marking it as a duplicate would help anyone.

I agree. The two questions about which you asked are not dupes. Marking question A as a dupe of question B means more than that one of the answers to B also answers A. It means more, even, than that every correct answer to B yields an answer to A (which pattern is what I infer to be the basis for the dupe suggestion in the case you asked about). Related questions are not necessarily duplicates of each other.

However, SO custom does recognize dupes that are not identical, and that therefore admit answers that differ somewhat in irrelevant detail. That includes many questions where A is a special case of B, which crop up fairly often. The situation you asked about could present such an appearance, but the fact that the best answers to each are different from the best answers to the other distinguishes it.

10
  • 2
    "that differ somewhat in irrelevant details". SO doesn't care that you want to the answer to 3+6 or 2+2, the specific numbers being added are irrelevant, the operation of addition isn't.
    – Braiam
    Commented Nov 28, 2018 at 14:58
  • 1
    Very well, @Braiam, I have edited the answer. That makes my point clearer, I think, so thanks. However, whether differences in detail between answers are "relevant" is in part a value judgment. An OP just looking for te codez may not think any answer that they can't turn around and submit as-is to their instructor is relevant. Commented Nov 28, 2018 at 15:16
  • 2
    I don't think that "How do I remove a number of given indices from a list" qualifies as a duplicate for "How do I remove one index from a list". If so, the duplicates have to be the other way round as all answers to the first will answer the second. But not the other way round. In fact, only one of the 7 answers can be applied to the new question.
    – BDL
    Commented Nov 28, 2018 at 15:20
  • 1
    Yes, @BDL, as this answer already says. I agree with you and with the OP that the dupe suggestion he asked about is not appropriate. Those two questions are not dupes. If the wording of this answer reads differently to you then I would appreciate hearing where the confusion arises, so that I can fix it. Commented Nov 28, 2018 at 15:30
  • @JohnBollinger: Hmm, I got confused by the "I agree, ... However...". The second paragraph (after the first tag agrees) reads as if you think that the currently discussed case is such a question where two not identical questions are still duplicates. At least that's what I understood.
    – BDL
    Commented Nov 28, 2018 at 15:33
  • Thanks, @BDL. I have revised the answer text to something that I hope is abundantly clear on my position with respect to the specific two questions that the OP asked about. Commented Nov 28, 2018 at 16:15
  • 4
    I want to note a nuance. Consider the case where A is a special case of B. It's typically wrong to close B as a duplicate of A (since some answers to A won't be applicable to B). But perhaps less intuitively: sometimes it's also wrong to close A as a duplicate of B, because there may be solutions that are only valid in the special case but somehow superior (e.g. shorter, faster) than the general-case solutions at B. Figuring out whether to close special cases, therefore, requires recognising such scenarios - which takes care, thought, and domain expertise.
    – Mark Amery
    Commented Nov 30, 2018 at 12:03
  • 2
    I agree, @MarkAmery. Perhaps I have been too parsimonious with my words, but they are chosen carefully: dupes that are not identical include many where A is a special case of B, but that does not and is not meant to imply that all special-case questions should be subject to closure as dupes of more general case questions. Commented Nov 30, 2018 at 17:07
  • @JohnBollinger Oh, don't worry - I had already inferred from your use of the word "many" that you had considered precisely this point when writing the final paragraph of your answer, and I didn't mean to imply otherwise. I just thought it was worth having a comment spelling it out explicitly, for the sake of other readers to whom it might not be obvious.
    – Mark Amery
    Commented Nov 30, 2018 at 17:13
  • @MarkAmery I think my first comment covers your "special case" case. If the irrelevant details are removed—ie. you could cut down as many as them without compromising the core of the question— is still the same question.
    – Braiam
    Commented Dec 2, 2018 at 1:14
3

Closing questions as duplicates serves the purpose to allow a question to be phrased in different ways, while preventing the answers from spreading across differently asked questions. This increases discoverability by allowing a question to have multiple versions, and increases a visitor's chances of finding an answer, even when they don't fully understand their question.

Both questions are duplicates of a 3rd question, that hasn't been asked (presumably, I haven't searched): "How do you build the difference set of A and B, where A is defined as a List, and B is defined as a predicate?" That's the canonical question, the type of question that should be asked on Stack Overflow (yet in the vast majority of cases isn't being asked). If there are multiple ways to deal with special cases (where B is the empty set or has a single element), then those can be easily addressed in an answer to that question.

In this particular case, I would certainly side to close the questions as duplicates. I'd probably close the second one as a duplicate of the first (as ordered in the question), simply because the first is the more general question. Deleting one item is just a special case of deleting several items.

6
  • 4
    I think this is too theoretical and very unhelpful in practice. Are you suggesting that the correct answer to "how do I remove 1 item from my list" is to use a predicate to define a 1-element set and then use the code to remove a set of items? It would work, but it's not a useful answer to that question. Take a .net List, for example which has methods to remove 1 item, or to remove N sequential items from an ordered list (another special case), but removing a set with a predicate is a more abstract and hard to understand method for novices. And is totally unnecessary code. Commented Nov 29, 2018 at 18:09
  • 1
    ... In the .net List example those 2 special cases have different answers to your canonical question, therefore they need to be separate questions. If someone asks about a special case the answer should point the user to the library method that does exactly what they want. Commented Nov 29, 2018 at 18:11
  • 2
    @stu: The .NET dilemma. Its authors seem to think, that a perfect library is one, where there's nothing left to add, when really a perfect library is one, where you cannot remove anything without removing functionality. No, the canonical question is not too abstract. It is clear, concise, and leaves enough room for answers to improve, as the library changes and leaks ever more implementation details. Besides, Stack Overflow isn't primarily for novices anyway. But if a novice fails to understand their problem they need to solve, they can ask a question and get introduced to the abstract issue. Commented Nov 29, 2018 at 18:25
  • By way of the duplicate. Commented Nov 29, 2018 at 18:25
  • So when removing 1 object from a .net List, for example, you use RemoveRange to do it? Because that's the answer you are pushing to have on here Commented Nov 29, 2018 at 18:29
  • 1
    @stu: I'm promoting the idea to have canonical questions. If the leaky abstraction of a library interface suits itself to have multiple ways to do the same thing, then the answer to that question can address those and provide rationale along the way. No matter how you slice it, both questions linked to try to solve the problem I put in abstract terms. Commented Nov 29, 2018 at 18:44
-8

is to help people find the right answer by getting all of those answers in one place

If all of those answers doesn't answer one of the question, then having all of them in "one place" only serves to confuse and mislead readers. Remember, we want questions to have answers that answers them. Look at this from this point of view: if you asked for Honeycrisp apples for an apple pie and got instead Red delicious to eat raw, are we giving you what you asked for? No, because while you asked for apples, the apples we are giving you aren't what you determined to need for the purpose you stated.

5
  • BTW, removing a multiple objects using targeted methods can give a performance hit compared to other solutions. So the solution that is proposed, unless it takes the same amounts of cycles to delete n amount of objects, would make the operation slower than needed to be.
    – Braiam
    Commented Nov 28, 2018 at 10:46
  • "if you asked for Honeycrisp apples for an apple pie and got instead Red delicious to eat raw, are we giving you what you asked for?" This is awful, I find it more akin to asking how to cook an apple pie in the oven and getting an answer for how to cook an apple pie under the grill(?), both lead to the same result even if the method is different. i.e. perfectly acceptable (although not in all cases) Commented Nov 28, 2018 at 14:43
  • @NickA but the objective isn't just preparing the apple pie, is preparing the apple pie with the tools you have available. If I don't have a grill, it doesn't matter that your method is the best, it's not applicable to the valid constrains of my situation.
    – Braiam
    Commented Nov 28, 2018 at 14:56
  • I understand that, hence not in all cases, but for example removing the 2nd element from a list and removing the 3rd element from a list is the same question even if the answers are different. My comment was more just to clarify that this (answer) is not always the situation Commented Nov 28, 2018 at 15:17
  • @NickA that's why my answer hinges on the details. How to get X objective with Y tools, is not a duplicate of how to get H objective with K tools, despite their similar sentence construction.
    – Braiam
    Commented Nov 29, 2018 at 13:31
-8

The same answer can legitimately solve two different questions. That doesn't, in itself, make them duplicates of each other.

But providing a link (in a comment or answer perhaps) pointing this out could certainly be useful.

You must log in to answer this question.

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