Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

This edit suggestion made by user A takes (reasonable-seeming code) suggested by user B and applies it to an answer by user C.

Should I:

  • Reject the edit on the grounds that user C should make the edit only if he/she feels it is appropraite?
  • Approve the edit on the grounds that this looks like a good suggestion?
  • Only approve the edit if I have domain knowledge and know that this improves the answer, and ignore the edit otherwise?

In general, when is it acceptable for one user to edit another user's answer in a non-trivial way?

share|improve this question
up vote 5 down vote accepted

In that specific case, yes. The code is broken, and anyone with experience in that language will see that the revised version is provably more correct than the original version. The original version has a bug that will work 99% of the time, but it's that 1% that will absolutely kill someone trying to debug the whole program. Please don't allow bad and wrong code to exist on stackoverflow if you are given tools to fix it.

In the same way that we fix bad grammar for the sake of clarity, we should fix bad code for the sake of good development and easy debugging.

However, as others have pointed out, such edits should only be accepted if you are certain that the code is wrong and not just because you prefer a different technique or style.

When in doubt, ignore it to let another reviewer with possibly more experience fix it, or reject it if you have a strong suspicion that the edit is worse.

share|improve this answer

IMHO, code should nearly always come from the poster him/herself, since it provides the substance of the answer. Unless it's Community Wiki, outside edits should just be a way of making the poster's point more clear (via formatting, cleaning up the English, etc.), without changing what the user is saying. Once you change the code, you're taking over the answer rather than clarifying it.

It might be appropriate to do this in the case of misinformation or something similar, but it seems to me that that's what downvotes are for.

share|improve this answer

You must log in to answer this question.

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