10

I'm wondering if the edit (revision 2) made at https://stackoverflow.com/posts/40221029/revisions is an ok edit to make.

enter image description here The edit significantly changes the original author's intended answer, and while I understand it's making it more efficient and maybe more secure, I don't think an editor should be doing that to someone else's answer. Am I wrong?

6
  • 5
    No, you're not wrong. It should've been a comment, or a new answer. Edits like that have a rejection reason for <2k users Apr 9, 2020 at 8:22
  • 4
    What is your end-goal? Having an efficient, more secure but still correct answer for many visitors to come or a single OP that had their intent and possible pride scattered.
    – rene
    Apr 9, 2020 at 8:41
  • 1
    Other question: Why did you delete your own answer on that Q/A? Is there something we should know but you forgot to tell us?
    – rene
    Apr 9, 2020 at 8:43
  • 1
    @rene the deleted answer uses mysql, the other uses mysqli. The question also asks specifically about mysqli. Guessing that's why Apr 9, 2020 at 9:09
  • 2
    I don't agree that it "significantly" changes the intended answer.
    – ivarni
    Apr 9, 2020 at 9:38
  • 1
    @rene I deleted my own answer because it was dated and also was mostly identical to the other provided answer so it was unnecessary. It was also worse than the other answer in its original unedited form. Overall it was just a bad answer which I had even forgotten about
    – apokryfos
    Apr 9, 2020 at 10:47

2 Answers 2

5

Your concern is valid, but in this case, the edit was warranted and correct.

The original problem posed in the question was about a reversed order of operands. The answer could do without the code and simply explain that mysqli_query() takes the connection object as a first argument. The rest is insignificant.

However, the rest of the code was a bad example and it could use some polishing. YCS added the necessary bits and fixed the incorrect logic. The answer is still the same, but the code example is now much better. There was no harm done; only improvement. The edit did not change the original author's intended answer.

If an SME decides to salvage an answer and improve it up to modern standards, you should consider it as a win. The content posted on Stack Overflow is a collaborative effort and if you see someone making a mistake in their answer you can edit it and improve as long as you do not change the meaning. Sometimes this could mean even a big rewrite of the exiting answer. If the original author decides to roll back the improvement, then it is their loss.

The same applies to your answer on that question. Your suggestion was really good, but the code sample was broken. YCS kept the meaning the same and fixed the mistakes.

You should roll back edits if and only if they are harmful or change the intent of the original answerer.

2
  • 1
    I love this answer.
    – Cody Gray Mod
    Apr 9, 2020 at 16:39
  • That was the original intent of editing on Stack Overflow (improving and keeping information up to date), but unfortunately the (by design) ego-driven nature of Stack Overflow prevents collaborative editing in most cases (reducing it to (still valuable) copy editing). Apr 10, 2020 at 15:29
10

I believe Stack Overflow is a collaborative effort-based site.

There are many answers that changed their content significantly, based on the collaborative effort. Take, for example, this answer and how does it look now - all thanks to the collaborative effort, driven by the intention to provide the best information for a site visitor.

I believe that the original intent was to provide as best solution to the problem as possible, that could be used by the OP as well as people who would land on this question from Google. From this point of view, the edit is following the original intent.

3
  • 5
    I completely agree with you. I know that normally code edits are frowned upon. However that doesn't mean they Should Not Be Done™ but rather, they should be done carefully and only when needed. I believe that's what your edits were and you acted in good faith.
    – VLAZ
    Apr 9, 2020 at 9:29
  • My concern with your edit was for two reasons: (a) I had an answer there which was made identical with your edit to the other answer. Someone dropping in from google would probably not understand why there's two identical answers to that question (b) You changed the query itself from SELECT * to SELECT COUNT(*) and I think the original intent of the author was to provide a way to get all results as well as the number in one operation. I do understand this doesn't work in all configurations but this small change did require a lot of explanation as to why it was made
    – apokryfos
    Apr 9, 2020 at 15:08
  • 2
    @apokryfos your answer was not equal to the other one as you introduced the OOP syntax, which made the difference: " if you opt for OOP rather than procedural". And I carefully preserved it, so the two answers was as different as before - running the same query but getting the result using different syntax, one procedural and one object. Apr 9, 2020 at 15:13

You must log in to answer this question.

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