8

Stack Overflow recommends adding a Minimum, Reproducible example to certain questions. As an editor, is it appropriate for an edit to include a minimum reproducible example when one does not exist? I recently made this edit where I added an example demonstrating how to order XML by attribute value in Groovy (using one of the classes referenced by the original poster), but without maintaining comments.

Originally I was attempting to answer the question, but realized I couldn't find an elegant way to achieve the requirements specified by the original poster. So I "repurposed" my code block to be used as an example instead of an answer.

Thoughts on if this is or is not appropriate and why?

6
  • It is good to have this, but ideally authors should provide MRE Commented Dec 1, 2021 at 14:51
  • About the edit. 1 You're using a quote, but there is no quote. It's meant to be used to say "this other person said this and that's what they said". 2. There is no code "following" that line.
    – Scratte
    Commented Dec 1, 2021 at 14:54
  • 2
    @Scratte good catch. I fixed the styling and verbiage. Thoughts on the content itself? Is it appropriate to add code where no code exists? .... also I changed the link to point to the specific revision ( since a new revision was made I dont want to confuse the reader ) but it doesn't really show my edit anymore Commented Dec 1, 2021 at 14:57
  • 3
    I remember a recent post where the answer was a hearty no, because it is too easy to change the intent of the post this way if you get it wrong.
    – Gimby
    Commented Dec 1, 2021 at 15:01
  • 11
    I know you mean well, but I don't think it is appropriate at all. We don't know how the OP code looks like at all. Commented Dec 1, 2021 at 15:02
  • @JeanneDark yes I would say that addresses the issue. I did a cursory search before asking the question but the results didn’t seem to indicate it had been asked before Commented Dec 1, 2021 at 15:45

1 Answer 1

10

No. Your MCVE may be different to what the OP wants. Looking at the edit privilege page, it says this:

Some common reasons to edit are:

  • to fix grammatical or spelling mistakes
  • to clarify the meaning of a post without changing it
  • to correct minor mistakes or add addendums / updates as the post ages
  • to add related resources or hyperlinks

None of which say to add code/MCVEs. The new MCVE may also slightly change the meaning of the question. Instead, ask the OP for an MCVE in the comments

Only edit in an MCVE if the OP showed you it already (e.g. in the comments)

2
  • 1
    If the post has code which reproduces the issue, but that code is not minimal, then an edit which reduces it to a minimal example could be considered "to clarify the meaning of a post without changing it". Otherwise I agree - the normal reason a MCVE is needed is because the OP has not adequately described their problem in order for someone else to know what the meaning of their post actually is, in which case a clarifying edit can't help but change the meaning.
    – kaya3
    Commented Dec 2, 2021 at 2:24
  • "Some common reasons to edit are" that list is not exhaustive. The "Any time you feel you can make the post better, and are inclined to do so. Editing is encouraged!" sentence includes anything that improves the post.
    – Braiam
    Commented Dec 3, 2021 at 10:33

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