Here's a pattern I've seen several times (I can provide examples if needed).

  • A relatively new user posts a question, including a code sample that illustrates the problem.
  • Somebody posts an answer (or perhaps a comment) that provides the solution to the original poster's problem.
  • The OP edits his own question, correcting the error he was asking about.

The urge to fix incorrect code is understandable, but I think it's obvious that this isn't the right thing to do; by leaving only the correct code in the question, future readers can't see what the original problem was, and the answer no longer makes sense. (I've rolled back such edits a few times.)

My question is this: What can we do to discourage this kind of thing? Or, more positively, how can we encourage new users to leave their illustrative incorrect code in place? Is this worth a new top-level FAQ entry?

  • 1
    +1 Happens way to often. Usually someone will roll it back and leave a comment saying that the edit invalidates all the answers. – Mysticial Jul 31 '12 at 9:02
  • It also see this sometimes whiel reviewing. Which is a valid reason to reject as not a valid edit. – Toon Krijthe Jul 31 '12 at 9:04
  • 2
    I've also rejected a lot of suggested edits from users other than the OP that are correcting the problem code the question is about. I often wonder how many get approved. – vascowhite Jul 31 '12 at 9:07
  • As long as the asker remembers to put SOLVED in the title, I'm Ok with it. That way we know it has been solved properly. Perhaps it would even be more helpful if they put UPDATE: before their title too. – user7116 Jul 31 '12 at 14:06
  • @sixlettervariables Hasn't that been discouraged? meta.stackexchange.com/q/86278/147645 – JimmyPena Jul 31 '12 at 14:19
  • @JimmyPena: only if you leave out the <sarcasm> tags. – user7116 Jul 31 '12 at 14:37

What can we do to discourage this kind of thing

I'm not sure there's much that can be done, other than

  • rolling back changes to code that make the question useless
  • leaving comments so others can see why the rollback occurred
  • reject edits to questions where the code is being fixed and explain why

Explaining it publicly (nicely!) so that anyone who views the question can see it seems like the best prevention. Something like

@userwhomadeedit If you "fix" the code in the question it makes the question less relevant because nobody can see the problem. Please correct the code by posting the corrected code as an answer.

  • 1
    Agree, but I feel like 'useless' is an 'unfriendly' word. Perhaps instead: ...it makes the question less relevant because... – Gaffi Jul 31 '12 at 13:41
  • 2
    @Gaffi you're right, although I'm also partial to "it invalidates the question" – JimmyPena Jul 31 '12 at 13:58
  • That's just as good to me as well! – Gaffi Jul 31 '12 at 14:00
  • "Your question is not a question if you include the answer." – user7116 Jul 31 '12 at 14:06

You must log in to answer this question.

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