34

I was wondering if I should update a answer given on a question that already has been accepted?

For my feeling the code was not perfect and complete, but for the person asking it was good enough.

So should I update the answer or should I leave it like it is?

4
  • 19
    Could you imagine anyone answering "no"? The real question is: Do you wish to invest the time? Your choice.
    – usr
    Commented Jul 12, 2014 at 21:17
  • 1
    Of course i want to provide the best answer as possible.i already invested time before i asked the question.i only was not sure if i should update if the question is already excepted.better be sure.Thanks for the advice all.
    – Creator
    Commented Jul 12, 2014 at 22:33
  • 2
    Once an answer has been voted on, commented on extensively, or marked as the selected answer, any significant updates (that don't simply correct minor spelling errors, etc) should be somehow identified. But, given that, it's not only acceptable but a courtesy to future readers to edit in clearly-marked updates that provide additional details, alternative approaches, or which alleviate significant shortcomings of the original. For out-and-out bugs one should probably include a note such as "Updated 7/14/2014: Corrected bug in glibnix formula".
    – Hot Licks
    Commented Jul 14, 2014 at 18:41
  • 1
    I believe accepted answers may be changed, but not substantively so without it being immediately apparent. I usually call out the edit with a horizontal rule. See this answer for an example: stackoverflow.com/questions/10143726/… Commented Jul 14, 2014 at 18:56

5 Answers 5

56

Ask yourself the question: will my edit make the code more accurate, or make the explanation better?

If the answer is Yes, then do it - it's your answer, improve it as you need to. Ideally answers should be of value to people in the future as well as the OP of the question you answered.

1
  • 1
    This is valid whenever is your answer or someone else. Don't let anyone get in the way of making the site a more technically correct source of information.
    – Braiam
    Commented Aug 21, 2018 at 18:20
29

If you feel like the updated answer will help others better - sure, go for it.

One note here: Stack Overflow/Exchange is designed for the "long tail" of questions. That means not only are we trying to help the asker, but we're also trying to help future visitors. If it helps the original asker - great! But what's even better is if it helps future visitors, because that's really what Stack Overflow is all about: helping not only one person but many with the same problem.

So by improving your answer, you're improving it for future visitors, too!

1
  • 2
    This is an opinion/response I agree with. If I am pulled into a post that has requirements that are super unique (and almost non-reusable elsewhere) to the poster's environment, I try to expand on it with intermediate "steps" that can be used generically by other visitors and searchers who may not operate in as strict a situation. Contrary to popular beliefs that focus on rapidly increasing reputation scores, the "quick and specific" answer that helps only one person in the end should be frowned upon at best. Commented Jul 14, 2014 at 7:18
13

I'd say yes, go for it!

Your answer is there not only for the original question author, but for anyone who comes across the question later. If you feel updating your answer would improve it, by all means do it -- the original asker may never notice, but who knows who you might end up saving or helping down the road.

1
  • This is also valid whenever is your answer or someone else. Don't let anyone get in the way of making the site a more technically correct source of information
    – Braiam
    Commented Aug 21, 2018 at 18:21
7

Yes.

Whenever I read one of my older answers and notice room for improvement, I edit it. This will make the answer better for all future readers, even if the person who asked the question will not notice the change. All changes are recorded in the revision history, so don't hesitate; you may simply rollback if needed, and the previous version will still be available in case anyone is interested.

It's a good thing to look at your own profile and re-read your high-scoring answers. You might be able to make them even better, even if only slightly.

5

Yes. If you find that you can make the answer more complete and correct, then absolutely edit it.

However, I'd like to add one thing that the other answers haven't mentioned here. The OP accepted your original answer, so it must have been useful to them (and therefore would probably be useful to others). If your new solution is significantly different from the original answer (i.e. not just typos, or silly mistakes you overlooked the first time around), then I'd suggest including it as an addendum under your original answer. You never know, maybe for some reason the first answer worked better for the OP than your second one would. So for the sake of completeness, I prefer to keep the accepted solution as well as my corrected / updated solution, just in case someone finds the original useful, as well.

1
  • 1
    Sometimes an answer has multiple forks, and one fork of it is absolutely, definitely broken. I don't think keeping that absolutely-broken code around is defensible, when if the answer was helpful to the OP they clearly didn't use it (ie. they obviously used the other option given). Commented May 20, 2016 at 22:18

You must log in to answer this question.

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