If I have kept working on the code, and there are no answers (say one week after the original post), am I allowed to edit the code to reflect the changes I have made to it?

I believe this question is closely related (yet not a dupe, I hope) to:

What makes me thinks this is not a dupe:

  • The first question is about whether the OP found a bug in his question, but does not necessarily take into account whether any answers exist.
  • The second question specifically asks when there are already some answers but they don't cover the whole code.
  • The third question may seems to answer this question, however, this question, is also narrowed down to a question which have answers

I am aware that someone could be working on the code review, which would explain why there are still no answers. However, after one week or more I would think that the question just not made it but I could be totally wrong.

  • 5
    \$\begingroup\$ In short, yes. Edit your code/question as much as you like before it has answers. I used "yet another" question as the duplicate close reason because the discussion in the answers of that question go in to more detail, and it is a FAQ \$\endgroup\$
    – rolfl
    Jun 26 '18 at 15:11
  • \$\begingroup\$ Thank you for your time and answer, I did see this question but what made me doubt was "You must not edit the code in the question, as that would violate the question-and-answer nature of this site. " in the last paragraph of the accepted answer. \$\endgroup\$
    – L. Faros
    Jun 26 '18 at 15:18
  • \$\begingroup\$ Besides, could you tell me if this question could be improved in order to no longer be a dupe ? Because, for new users like me I believe this is an important point but even after reading the question codereview.meta.stackexchange.com/questions/1763/… I had the impression that while clearly related the two questions are not totally dupes ( for instance what you answered in comments seems to contradict what is said in the answers from the questions you linked) \$\endgroup\$
    – L. Faros
    Jun 26 '18 at 15:25
  • 1
    \$\begingroup\$ How about I reopen this questoin (un-dup it), and see what happens. It can be closed as a dup again later if that is appropriate. \$\endgroup\$
    – rolfl
    Jun 26 '18 at 15:57
  • \$\begingroup\$ I edited my question to add a third bullet point including the question you linked as dupe, English not being mother thongue ; I would be glad to know any improvments. \$\endgroup\$
    – L. Faros
    Jun 26 '18 at 19:54
  • \$\begingroup\$ Not only it is allowed. It might get your question some more attention, since an edit will bump the question to the active page. \$\endgroup\$
    – Ludisposed
    Jun 27 '18 at 19:56

Sure you can edit your question/code if there are no answers. Just don't place alternative code-junks without adding the comperative-review tag.

Replacing the code in question is fine without tagging it.

If one is doing a review at the same moment he/she will maybe place a comment asking when you will be finished (I did so on another question). If you see such a comment you should place a comment as well answering the question. Otherwise the reviewer may lose interest in your question.

After you get an answer you won't be allowed to edit your code. Adding some methods/classes which are requested usually don't hurt.

  • \$\begingroup\$ Does it notify someone answering if an edit is occurring on the question? \$\endgroup\$ Jun 27 '18 at 4:28
  • \$\begingroup\$ @Raystafarian if the answerer has the question open in his/her browser then yes. \$\endgroup\$
    – Heslacher
    Jun 27 '18 at 4:43
  • \$\begingroup\$ Ah, okay, I guess I forgot. I remember it shows up if you edit at the same time, but thanks! \$\endgroup\$ Jun 27 '18 at 4:44
  • \$\begingroup\$ Thank you for your answer, however, would you mind explaining me what do you mean by " Just don't place alternative code-junks without adding the comperative-review tag." \$\endgroup\$
    – L. Faros
    Jun 29 '18 at 21:37
  • \$\begingroup\$ What I mean with alternative code-junks is placing different versions of code which try to solve the same problem. Like Alternative 1:, Alternative 2:.... \$\endgroup\$
    – Heslacher
    Jul 2 '18 at 8:56
  • \$\begingroup\$ I don't really like this answer. What if I'm in the middle of writing up my answer, then halfway through, the code changes, invalidating it? Especially on CR, where answers tend to be longer and more in-depth, that's a real risk. That said, it's not at all unreasonable to suddenly realize you posted old code, or copy/paste broke formatting, or whatever, so it's reasonable to allow edits to 'fix' when you have no idea that someone is commenting, so... Dilemma! Yay! \$\endgroup\$
    – Nic
    Jul 5 '18 at 20:42

I tend to agree that you can edit the original question if there are no answers to invalidate. However, you risk the possibility that someone is answering right at that moment. That person would be entirely justified in rolling back your edit even if your edit is made before the answer is posted. That risk is obviously lower a week later than it would be in the early minutes of the posting.

So long as you understand and are willing to take that risk, go ahead and edit.

If someone does answer and roll back your edit, you can then post a new question with the revised code as an iterative review. So your work isn't wasted. But you might have to do more work to take advantage of it.

That's the risk you take.


You must log in to answer this question.

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