18

In general when I answer a question, I try to explain my answer, which takes some time to write out. When the question is pretty simple to answer, this sometimes means that someone else will post a quick code only answer or other answer with poor explanation before I can post mine. At this point, I am never sure what to do. On one hand the answer is already posted and the general consensus seems to be avoiding duplicate answers. On the other hand, the other answer could use improvement because it doesn't help the asker understand why the solution worked.

As I see it, there are four possible solutions

  1. Post my answer anyway.
  2. Don't post my answer at all.
  3. Edit the other answer to include my explanation.
  4. Start taking this approach and just post a quick answer, then go back and edit it to make it better.

I have problems with all of these options. If I post my same answer then it is duplicating the information and "junking up" the answer section. If I don't post, the asker (and future readers) may not understand why the code works. If I edit the other answer, I am putting words in the other person's mouth, and they might not agree with what I have said. If I post a quick answer it feels like I am just racing for rep, plus if I lose the race, I am stuck in the same position of deciding what to do with a duplicate answer.

2
  • 10
    Surely that recommendation does not apply when you are writing an elaborate answer? There is no use for identical answers. You can play the FGITW game if you prefer. Most likely outcome is that you'll quickly tire of it, not a very fun game. Commented Dec 15, 2016 at 19:06
  • 2
    @HansPassant I guess maybe that is the answer to my question, an answer that expands on someone else's answer isn't a duplicate.
    – Barker
    Commented Dec 15, 2016 at 19:14

2 Answers 2

19

This is a well-known 'problem' of questions which can be answered with a short code snippet. There are often only one or two feasible solutions, so if a few people are writing an answer simultaneously, they are likely to end up with the same code.

If your answer is of significantly better quality than another answer posted just a bit earlier, by all means keep it. Writing an explanation about what the code does is a good example. You might receive a comment complaining about plagarism but a quick look at the timestamps will show people that it isn't.

So go for option 1. It's not your job to write an explanation to somebody else's code.

3
  • In response to: "If your answer is of significantly better quality than another answer posted just a bit earlier, by all means keep it." This doesn't come up as often, but do you think I should still post if it is an older answer that is being expanded on? If I find a question with a code only answer from a month ago, should I still post a new answer?
    – Barker
    Commented Dec 15, 2016 at 19:33
  • 6
    I'd say, yes, still post as a new answer, however give the original answer credit where credit is due.
    – Kevin B
    Commented Dec 15, 2016 at 19:35
  • @KevinB so, none, because I already know that part of the answer.
    – Braiam
    Commented Dec 16, 2016 at 23:12
1

I'd say:

  1. Decide if your answer is much of an improvement on another, or only a little tweak. If you think it is different enough, post it separately.
  2. If your answer is different enough from somebody else's, but still is based oh theirs, credit and link to the original answer.
  3. If you are tweaking someone else's answer, leave some mention of your edit with your nick in the answer: "edited by codelurker to clarify the explanation in the 2nd paragraph" or "edit: >NL< to understand this, you may need to know that ..." etc.; unless it either just 1) spelling corrections, 2) grammar corrections where there is little doubt that the original and revised meaning are the same, or 3) formatting improvements that don't change the meaning.
  4. It is good to try to communicate with someone whose answer you edited. E.g., if you just mention their nick in a comment, they will have a message about it in their inbox.

I say that if we weren't supposed to edit each others' answers, it wouldn't have been designed that way. Sometimes editors come in and improve the formatting of your answers. I've had another user help me with my formatting before. I think you indeed don't want to junk up the answers with a lot of slightly different answers to a question. If the original answerer knows about your edits and doesn't disapprove, you aren't putting words in another person's mouth. An original answerer alerted to the edits can always go back and look at the editing history of an answer, and even revert it.

I would like Stack Overflow avoid the problem of WikiPedia, of having armies of highly-biased editors marginalizing and burying significant alternative viewpoints. By leaving notice that an answer has been edited, it allows someone to take credit for the unusual dual or more authorship of the answer, and it queues the reader that a second person has edited it; and if one knows how, it is a quick process to go into the revision history of an answer and see what was originally written. It would not make sense for them to have notes below every section that somebody did significant edits to. The lists would be HUGE. The situation is different for Stack Overflow, where, for the most part, each person gets to post one or more answers; but most answers are by a single poster, excepting minor corrections. Imagine a correction like "edited by CodeLurker to fix an uninitialized pointer reference in the washElephant() function". Someone going back and seeing that who has used that code, would know that there is a fix that they need to paste into their code, for a bug they probably haven't hit yet (or they could just test every line of code, like they probably should). I suppose ideally, there might be a button to press, and see other contributors to the answer, along with notes as to a quick overview of what each contributor did. Even that wouldn't be as instant as being able to significant edits at a glance. Perhaps it is more about warning of important edits; but the need for warnings is only enhanced, not diminished, by another editor, IMHO. While they are not so much of a factor here, another contributor does bring an added risk of political motivations for the editing, as well as simply a different philosophy or approach - which sometimes may not even be apparent to him or her. I think significant edits made by an original author or other party, do not need to be warned of, if the answer has just recently been posted; and the chances are poor that someone has already used the code or technique in their program.

I think a short answer which adds (significantly) to another's answer is valid. I've seen helpful comments that way. I'd say, just link to the original answer, and add your additional info, e.g. "it helps if you rub on his elbow and wear blue suspenders".

8
  • What exactly do you mean by "signaling" your edit? Significant edits to a post always notify the owner anyway, and we definitely don't want a series of "ED 1: No, do this. ED 2: Actually, the first way is better." exchanges making up the fossilized layers of discussion within an answer. Commented Dec 17, 2016 at 20:10
  • That then would suffice to signal the owner. Discussing the edit be can well be done in the comments, taking it to chat, or I think, by personal messages. Still, I think if person A made the answer, and person B changed it, other than formatting changes that don't change the content of the message more than to correct spelling, formatting or grammar, it'd be good to have: "Edit: added better explanation of 2nd list item in answer". Different people can have very different approaches, and it would be good if a reader could know there may be something to look at in the original answer, IMHO.
    – CodeLurker
    Commented Dec 18, 2016 at 6:56
  • I suppose a lot of this has been being done based on judgement calls of readers, and there are cases in which most ways of doing it are right. I take this question as asking to spell it out in so many words. I guess there are two ways of signalling: automatic when it is edited, and a note to let OTHER readers know it has been changed by someone else.
    – CodeLurker
    Commented Dec 18, 2016 at 6:58
  • 2
    Any time there's reasonable doubt over whether the original author would agree with the new edit, it simply shouldn't be made, explanation or no. And if there's no real doubt that it's a simple improvement in the same vein, then the explanation belongs only in the edit summary field, which is designated for that very purpose. Answers as presented aren't supposed to require mental shuffling to work out the final version; they're just supposed to be the final version. Commented Dec 18, 2016 at 7:01
  • I agree that the final version should be concise and clean. I would not say that we should guess if the author should agree with the edit. I am not proposing putting the reason for the edits in the answer itself. Yes, for most cases, the edit summary field should work. I AM saying, a causal reader could use to see if a substantial edit has taken place, as a note at the end of the answer. I also am saying, it is good that the author knows, and if an attempt to communicate first for substantial edits, can be made.
    – CodeLurker
    Commented Dec 18, 2016 at 7:06
  • I could see a VERY SHORT description of the nature of the edit in the answer with a note at the end. I think the edit summary field should be where most of that is, and can go into much more detail, revision by revision. This is just my gut instinct, as a sometimes user of SO.
    – CodeLurker
    Commented Dec 18, 2016 at 7:08
  • 2
    I have on a couple occasions made substantial edits to other people's answers. I only do this if 1) I'm totally sure I know what I'm talking about. 2) the author of the post is still active ("last seen" in the past couple days) so they can review my edit and roll-back if they disagree. 3) Posting my own answer would be less useful than normal because it's a canonical Q&A with a lot of high-voted answers already, so any new one would be buried in noise. See meta.stackoverflow.com/questions/338481/… re: cleaning up canonicals Commented Dec 18, 2016 at 8:43
  • 1
    Of the three times I remember making questionably-significant edits, twice I've had the original poster thank me. (Once for improving their own understanding of the subject, not just the explanation :). The third time, the user rolled it back and said "thanks but I'd rather say it in my own words when I have the time to make this into a better canonical", since he's picky about his answers. That's totally fine with me. If there was a way to leave "suggested edits" as suggestions for the author only (not for the review queue), I would maybe have done that in that case. Commented Dec 18, 2016 at 8:48

You must log in to answer this question.

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