27

I asked a question some time ago and accepted an answer of a certain user. Some time later I figured out a much better way to solve my problem.

How should I post my better solution? As an edit in the original question or as an answer? Should I un-accept the not-so-good answer I accepted before?

3
  • 1
    If your new answer is truly different and you feel it's a better answer, then I think you should change which answer is accepted. On the other hand, if your new answer is better but not really different you should edit the accepted answer to improve it -- so long as you are not changing the meaning of the original. Note that I am biased; in stackoverflow.com/questions/6217055/… my accepted answer was unaccepted a year after the fact because the OP decided to improve my (weak but clearly sufficient) answer in a new answer instead.
    – mah
    Commented Feb 15, 2016 at 16:09
  • I agree with mah that a slight improvement to an existing answer is better done as an edit but be prepared for any edit that modifies code to get rejected. It's just really iffy getting that kind of thing approved without someone seeing it as changing the meaning of the post or something meant to address the OP.
    – BSMP
    Commented Feb 15, 2016 at 19:58
  • Related to this meta.stackexchange.com/questions/216719/…
    – g3rv4
    Commented Feb 17, 2016 at 18:05

4 Answers 4

49

Never put an answer in the question, that's simply not what it's for.

You can answer your own question though, and if you found a good different solution, please do!

Whether you should unaccept the answer you accepted though, and accept your own?
That's for you to decide, are you sure it's better? I personally would be reluctant to assert so until and unless if gathers at least a significant number of upvotes on its own.
It's just that unaccepting an answer feels like not having properly decided before, and being capricious, even though it isn't. Also, I might be biased about my own work, or at least blind to (some) of it's flaws.

7
  • relevant linky I stole from a related question: blog.stackoverflow.com/2011/07/…
    – Gimby
    Commented Feb 15, 2016 at 10:23
  • 26
    Given the statement, "I figured out a much better way to solve my problem." keeping the checkmark on a much worse answer isn't appropriate. The OP seems to feel pretty strongly that it's not just a marginal improvement, but rather a significant one.
    – Servy
    Commented Feb 15, 2016 at 15:50
  • 1
    I would say if the accepted answer did help, then leave it accepted. If it didn't, accept your own.
    – Sobrique
    Commented Feb 15, 2016 at 16:05
  • 23
    @Sobrique But that's not what the accepted answer is there to indicate. The accepted answer is there to indicate the answer that the OP feel is the best, not there to indicate any answer that helps at all, even if it helps less than another answer. If the answer is helpful it can be upvoted. It should only be accepted if it's the most helpful.
    – Servy
    Commented Feb 15, 2016 at 16:19
  • Although I do agree with most of your post -1 for not accepting the better answer.
    – PeeHaa
    Commented Feb 16, 2016 at 22:05
  • Shouldn't an SO reader find the best answer to a question as quickly as possible? I care less of WHO has the accepted answer, if it is the best one. Credits should be given where appropriate, though. Commented Feb 17, 2016 at 11:24
  • @PeeHaa Well, I just wanted to say that your own judgement of the relative merits of the new post might be a bit off, as it's yours. Otherwise, sure. Commented Feb 17, 2016 at 16:07
33

How should I post my better solution?

Like any other answer - post an answer. Do not post the answer as an edit to the question.

Should I un-accept the not-so-good answer I accepted before?

Any time a better answer comes along, be it yours or of someone else, accept the best answer. Up-vote those that are useful.

After accepting an answer, it would be wise to first let a new answer (yours or of someone else) to age (perhaps a few days) to see how the community rates it. Use that feedback as part of your decision to accept the new one or not.

6

I agree with the other answers, but I read in the Stack Overflow Tour:

Accepting doesn't mean it's the best answer, it just means that it worked for the person who asked.

So it is fully up to the original poster to decide. They can pick whichever answer worked best for them.

1

What I did with the following question:

How do I make a WPF window movable by dragging the extended window frame?

was post an answer of my own, move the accept to my answer, and award a bounty to the answer I previously accepted for having pointed me in the right direction, overwhelmingly making up for the accept (it was my pleasure to). You don't need to award a bounty as large as +100; the minimum of +50 will do if you're on a tight budget and need to preserve privileges.

See also Etiquette for accepting more detailed own answer based on original answer — I think what I did is an option worth considering regardless of whether your self-answer is related to the previously accepted answer or not.

You must log in to answer this question.

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