2

I made an answer on a post and got a +1. Great! I went to check back because I also posted comments on the another answers. That's where I noticed that one of the answers was very heavily edited by someone else!?

https://stackoverflow.com/posts/55962060/revisions

The code went from:

url.match(/.*\/\#inbox\//)[0]

To a completely different new code:

// Complete url
var url = 'http://test.example.com/#inbox/U2FsdGVkX19stSSdMXLZq5v7bOgzRLtaM7Lr1t+lWpI=';

var desiredResult = url.match(/.*\/\#inbox\//)[0];
console.log(desiredResult.substring(0, desiredResult.length - 1)); // this will output 'http://test.example.com/#inbox'

I think it is pretty clear that should be a big no-no, but I'm not too sure how to deal with such a situation. Are we supposed to click the "rollback" link?

20
  • 18
    From oneliner without explanation to PoC. Looks like a valid edit to me. Commented May 3, 2019 at 7:49
  • 8
    The edit introduced new code. It completely re-wrote the answer. It should just have been posted as a new answer.
    – Cerbrus
    Commented May 3, 2019 at 7:52
  • 1
    the post is locked for a day to stop roll back wars. The edit can then be either reintroduced or left out after that, depending on the consensus. i recommend listening to the tag's gold badgers.
    – user3956566
    Commented May 3, 2019 at 8:21
  • 1
    @YvetteColomb there were no rollback wars. Only one user rolled back and was to the worse version of the answer.
    – Braiam
    Commented May 3, 2019 at 8:22
  • 2
    @Cerbrus left a comment for the editor stackoverflow.com/questions/55944250/…
    – user3956566
    Commented May 3, 2019 at 8:24
  • 1
    @Braiam there's been a bucket load of flags under the post, so it's locked until it's sorted out here, ok?
    – user3956566
    Commented May 3, 2019 at 8:25
  • 13
    No code was changed in that edit. Commented May 3, 2019 at 8:51
  • 13
    Some trivial code was added. The original code remains unchanged Commented May 3, 2019 at 8:53
  • 3
    @MartinSmith the original answer is not great quality. It's up to the author to improve the cade. if it requires another user to put it in context, really it should be a new answer and that one deleted.
    – user3956566
    Commented May 3, 2019 at 8:56
  • 5
    @YvetteColomb - there's nothing wrong with showing a new site user by example how to improve their answer IMO Commented May 3, 2019 at 8:57
  • 2
    Alexis, can you please contextualize why you believe is completely different?
    – Braiam
    Commented May 3, 2019 at 9:00
  • 1
    The user only signed up for SO today so I doubt addiction will have set in yet! May be a while until they return Commented May 3, 2019 at 9:01
  • 4
    @YvetteColomb sadly, some users aren't as fanatics as we are ;P BTW, if you are expecting them to comment, they will not be able to do so. He has 1 rep, while commenting on meta requires 50.
    – Braiam
    Commented May 3, 2019 at 9:01
  • 2
    Yep and hopefuuly we haven't terrified them ;D dang one hand typing @Braiam and Martin
    – user3956566
    Commented May 3, 2019 at 9:02
  • 5
    @Braiam wow that's a major flaw. we need to be able to tag users so they can participate on meta posts regardless of rep.
    – user3956566
    Commented May 3, 2019 at 9:10

4 Answers 4

32

I disagree that a rollback was needed.

While the change may appear to be drastic, in the end it's only superficial and an improvement for the answer. I don't believe you need a gold badge in JavaScript to see the answer is the same before and after the edit, nor even a lot of JavaScript experience.

The answer's code remains the same:

url.match(/.*\/\#inbox\//)[0]

The only thing that the edit made was to surround that snippet with an actual example of use, while preserving the author's intention.

It added to the answer, without changing its core. Edits in answers are fine for this: improve without change. The post author is free to rollback if disagrees with the edit, no need to make the decision for them.

// Complete url
var url = 'http://test.example.com/#inbox/U2FsdGVkX19stSSdMXLZq5v7bOgzRLtaM7Lr1t+lWpI=';

var desiredResult = url.match(/.*\/\#inbox\//)[0];
console.log(desiredResult.substring(0, desiredResult.length - 1)); // this will output 'http://test.example.com/#inbox'

Rolling back that edit destroys value and preserves nothing. A new answer that simply included the same code plus the extra examples added no needed value. If questions like this are going to get answers, let's at least not answer multiple times the same thing.

It's great that this user chose to help instead of simply reposting. Edits are not reserved to correct spelling and formatting. Fixing and improving answers (while preserving the original intent) is a great use of edits.

Some past discussions about this, in no particular order:

While there is a lot of "it depends" on most of these discussions, I see no clear "touching code is inherently bad" in most answers to these. I tend to read: "It can be good and acceptable in some cases", and not "do not ever interfere with code".

The actual discussion here is: was it good in this case, or was it wrong? If if was wrong, why was it wrong? I can't see any harm done by the edit, and clear benefits. It's a user doing something good for the community, instead of posting yet another one-liner for teh pointz.

(I find it hard to believe that the question didn't need to be closed as a dupe, but that's a different matter)

16
  • 1
    How about the extra substring line the edit added? If you're gonna completely re-wite an answer, just add a new answer.
    – Cerbrus
    Commented May 3, 2019 at 7:50
  • 5
    IMO it's still an improvement and example of use, not an edit that changed the author's intention. The edit vastly improved the answer without changing its tune. Why lose that?
    – yivi
    Commented May 3, 2019 at 7:52
  • 6
    @Cerb, console.log(desiredResult) would have been ok, but removing a char to exactly match Op expected result is a complete rewrite. Commented May 3, 2019 at 7:53
  • @xdtTransform: It's a piece of functionality that was missing in the answer. You don't edit answers to change functionality, no matter how tiny.
    – Cerbrus
    Commented May 3, 2019 at 7:54
  • 5
    If it the edit was on a question, I would agree with you. On an answer? No, it's better to have the improved version.
    – yivi
    Commented May 3, 2019 at 7:54
  • It would've been better if that user just added a answer.
    – Cerbrus
    Commented May 3, 2019 at 7:55
  • 4
    Imo, Someone posted a valid answer. With not enought detail. People start to be picky with competing answer. then someone edited a MCVE into the answer. Added input, same code, expected output. Commented May 3, 2019 at 7:55
  • 1
    Except the code isn't the same, @xdtTransform.
    – Cerbrus
    Commented May 3, 2019 at 7:56
  • 1
    Interestingly, those links (thanks) don't seem to have a clear-cut conclusion.
    – Cerbrus
    Commented May 3, 2019 at 9:06
  • 1
    @Cerbrus precisely, it's not clear cut and you and i are old school, don't interfere with post code.
    – user3956566
    Commented May 3, 2019 at 9:09
  • 1
    @YvetteColomb If that's what matter, this guy is even more old school than any of us: It is generally a bad idea to edit code in questions on Stack Overflow, because you might inadvertently fix the problem code that the asker was facing. This reasoning only applies to questions, not answers.. BTW, you might not know it, but I'm very old school too.
    – Braiam
    Commented May 3, 2019 at 9:16
  • @yivi Note that I'm not the one who rolled back. I was asking the question here to have an idea of whether it was what was expected of an editor in such a situation. Commented May 3, 2019 at 15:57
  • That's fine @Alexis, I was aware you didn't perform the rollback. If you feel I'm implying you did, I can edit the answer to make it clearer that you didn't.
    – yivi
    Commented May 3, 2019 at 15:58
  • Yes, but for this kind of change it is a lousy and misleading edit summary: "improved formatting". Perhaps add something about this to your answer? Commented May 4, 2019 at 13:23
  • @PeterMortensen sadly, edits summary are as useful as not being there. I've written pretty clear and verbose edit summaries just to have my edits rejected by kneejerk reactions. There aren't as many reviewers that read edits summaries. Editors just learned that.
    – Braiam
    Commented May 8, 2019 at 9:44
11

The rollback by Cerbrus seems contrary to the general desire to have more than just "one liner" answers on the site, for example, see Cody's answer here:

Are there any guidelines to handle one-line (correct) code-only answers in various reviews?

I think this improved the answer by turning it into a worked example and provided some context about that particular line of code, i.e. how do I get here to use this? How do I use the results?

4
  • 3
    That answer by Cody is a great find.
    – yivi
    Commented May 3, 2019 at 11:43
  • @yivi - appreciated. I remember there being other Q&A's with the same sentiment but that one jumped out of my memory.
    – Kev
    Commented May 3, 2019 at 19:35
  • Sorry to hear that I've infected your memory. :-(
    – Cody Gray Mod
    Commented May 3, 2019 at 23:40
  • 1
    @CodyGray - mate your opinions pre and post diamond have always been worthwhile reading.
    – Kev
    Commented May 4, 2019 at 2:28
10

To anyone who knows JavaScript, the answer is functionally the same. The important part, the regex, is exactly the same before and after. If you read other answers, they offer similar supporting mechanism: storing the result of their selection mechanism in a variable.

But let's do a litmus test. Does it stop answering the question in the way that it was originally purported to?

let url="http://test.example.com/#inbox/U2FsdGVkX19stSSdMXLZq5v7bOgzRLtaM7Lr1t+lWpI=";
let orig = document.getElementById("original");
let modif = document.getElementById("modified");

orig.textContent = url.match(/.*\/\#inbox\//)[0];

var desiredResult = url.match(/.*\/\#inbox\//)[0];
console.log(desiredResult.substring(0, desiredResult.length - 1)); // this will output 'http://test.example.com/#inbox'

modif.textContent = desiredResult;
<p>Original</p>
<p id=original></p>
<p>Modified</p>
<p id=modified></p>

To even demonstrate the difference between both I had to add several lines of JavaScript and HTML. But in both cases, it resulted in the same result with the same method.

In case someone isn't reading the same post, let me add a screenshot showing the answer is the same:

side-by-side-markdown view of the edit

If it's totally a different answer, I would expect both perfectly hand circled to be the different. They are not.

16
  • 1
    So, what's your conclusion: Edit or new answer (with snippet)?
    – Cerbrus
    Commented May 3, 2019 at 8:10
  • 5
    @Cerbrus Improving the post is always desired.
    – Braiam
    Commented May 3, 2019 at 8:12
  • Even if that means there's nothing left of the original answer? When the answer already has a bunch of downvotes? Why bother with it when you can just post a new answer with a clean slate instead of a complete re-write.
    – Cerbrus
    Commented May 3, 2019 at 8:14
  • 1
    @Cerbrus are you even reading the same post? The line is still there.
    – Braiam
    Commented May 3, 2019 at 8:18
  • 1
    That doesn't mean it's not a complete re-write. It's just a new answer that uses the same regex.
    – Cerbrus
    Commented May 3, 2019 at 8:19
  • That post is 2 years old, I don't even remember writing that answer, not to mention what Shog commented on it.
    – Cerbrus
    Commented May 3, 2019 at 8:35
  • @Braiam: No, you seem to have some personal grudge against me and my actions on this site, based on a few interactions. That bears no relevance to this discussion, and is borderline slander.
    – Cerbrus
    Commented May 3, 2019 at 8:44
  • When I asked you to elaborate on this specific case in the second comment on here, you resort to ad-hominem comments: "are you even reading the same post?"
    – Cerbrus
    Commented May 3, 2019 at 8:48
  • 1
    @Cerbrus I frankly couldn't care less about you. Your dogma on the other hand, is very worrying. If you were Servy, Cody Gray or Shog himself that pushes it, I would argue you the same way. I will always be on the side of edits that improves the post, that puts me on the opposite side of those who doesn't. This edit improves the post and should be kept.
    – Braiam
    Commented May 3, 2019 at 8:48
  • 1
    @Cerbrus because I really wondered if you aren't seeing it. I need to make sure that one of us isn't making a honest mistake. If you can't see it as that, then you are the one having a problem. That's why I added the screenshot. In case someone isn't reading the same post.
    – Braiam
    Commented May 3, 2019 at 8:49
  • " I will always be on the side of edits that improves the post" So, who's dogmatic now, you or I? Isn't it hypocritical to dismiss my opinion "because dogma"?
    – Cerbrus
    Commented May 3, 2019 at 8:50
  • "Are you sure we're discussing the same post?" That comment could've been much less aggressive. Note: "We", link to the post, no "are you even"...
    – Cerbrus
    Commented May 3, 2019 at 8:52
  • @Cerbrus I'm not dogmatic. I'm following the help center guidance that Stack Exchange established in their site. Is that dogmatic? That seems to discuss semantics, but I'm following it. I'm a guest here, and I'm doing as the host ask me to. If I don't like what the host tell me, I can always leave.
    – Braiam
    Commented May 3, 2019 at 8:54
  • No, everyone has their own interpretation of things like that. You're writing your interpretation of the help center's texts here as fact. You mentioned "Dogma" before, but you're not free from it, yourself.
    – Cerbrus
    Commented May 3, 2019 at 9:00
  • @Cerbrus lets say both are using dogma. It's that all I'm using to defend my point of view? No. I provided evidence in code that both answers are functionally the same.
    – Braiam
    Commented May 3, 2019 at 9:10
-15

Completely rewriting an answer like that is not acceptable, especially considering the edit added functionality. The edit should be rolled back.

If you're going to write a new answer that uses some existing code, a better option would've been to add a new answer to the question. It's not uncommon to see multiple answers that have the same, or a similar approach.

You could also comment on the answer, explaining to the editor that they should add a new answer if they think it's necessary.

12
  • 2
    I see you've done it. Thanks :-) I'll know for next time. Commented May 3, 2019 at 7:40
  • 2
    As you're a gold badger in the tag, i'd be inclined to take your advice here.
    – user3956566
    Commented May 3, 2019 at 8:27
  • 2
    Appreciated, @YvetteColomb. Braiam, I don't mean to pull rank or anything, but who else has a JS gold badge in this discussion? I don't see them. I'm also not "Victimizing" myself. Just observations.
    – Cerbrus
    Commented May 3, 2019 at 8:29
  • @Cerbrus yep, that's why i made the judgement call to lock your rollback. i have a busted right hand, so excuse the typing.
    – user3956566
    Commented May 3, 2019 at 8:30
  • 2
    @Braiam: if the answers were same: what does it cost the editor to answer in his/her own words rather than editing another's expression with visibly drastic changes on how it should be addressed? Commented May 3, 2019 at 8:42
  • 1
    @Braiam: Q: "How do I log a variable?" A1: "console.log". A2: "Use console.log, here are some examples, and some links to documentation: <...>" The difference is that one is a dump of some code, and the other is an answer. Don't bother updating the dump.
    – Cerbrus
    Commented May 3, 2019 at 8:43
  • 3
    @Braiam fair enough on the second part. leave the first part alone, we don't need to attack each other personally. it makes for a toxic environment. Please? :)
    – user3956566
    Commented May 3, 2019 at 8:43
  • 1
    @nyedidikeke why don't I just expand on Mystical answer, then? I would copy the entirety of it and add 3 lines of code which doesn't change the core of the answer, but allow you to compile in rust. If that's the only thing qualifying for a new answer, I would start to copy the top 10 answers and just add some code to print to the console or store it in a variable (realistically speaking, I doubt they haven't demonstrated with examples their solution, but it's valid to dream, no?).
    – Braiam
    Commented May 3, 2019 at 9:08
  • 1
    I'm going to call it: Straw man.
    – Cerbrus
    Commented May 3, 2019 at 9:10
  • 3
    Cerbrus, the consensus (between votes and former examples) seems to be that in this case, since the core of the answer was preserved, it did not require a rollback... Commented May 3, 2019 at 17:41
  • I'm not sure why you're giving me an update on the votes on this question, @AlexisWilke?
    – Cerbrus
    Commented May 3, 2019 at 17:46
  • 3
    @AlexisWilke: the perceived majority isn't always right. Principles may at time be hard to follow but facts remain, even when bitter to swallow. That calls for a mature and conscious discretions in the true interest of the community. It isn't about winning or losing a debate, but sanity, for quality and posterity. :-) Commented May 3, 2019 at 22:06

You must log in to answer this question.

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