-7

Those rules we discuss everyday.

We have established rules on the network and it seems to me that it is important to follow them.
Some rules are there for good reason some are up to discussion on many posts here. We also have a good privilege system which is a good security layer against users that are new to the network or simply don't care about those rules.

But what is to do with a user that simply don't care ?

This is not a big deal I know..

When a user acquires a certain privilege, what is it to stop him from wrongly doing what we allowed him to do ?
Rollbacking what he does ? It seems to me that people are still able to do whatever they want to do even though we come here everyday to try and discuss concerns we have on certain subjects.

Yes, every body have their own interpretations of those rules and different opinions.

All this for a simple question :

Should I flag these comment or just don't care at all and let that user edit all the code he sees to add his personal formatting standards. ?

enter image description here

12
  • Can you link to the exact edit/s that are the issue?
    – Pekka
    Commented Dec 11, 2013 at 16:38
  • 11
    Im not clear - are you saying there is a global rule that you shouldnt be editing code-blocks which are badly formatted to make them well formatted? If so I break that rule all the time
    – Jamiec
    Commented Dec 11, 2013 at 16:39
  • 2
    The adding of braces in an answer, when not breaking anything, gets a great big meh from me. If it doesn't do harm, I won't roll it back. Questions however are a bit more iffy.
    – Bart
    Commented Dec 11, 2013 at 16:40
  • 1
    It seems like the user does care...that's why they took the time to edit in the first place. They just disagree with the idea that you shouldn't edit code. You might point them to one of the relevant meta discussions to show them why code shouldn't be edited (except for spacing). Commented Dec 11, 2013 at 16:41
  • 1
    I would be more worried about the fact that the first comment is thx guy in spite of the OP's first name, like seriously!
    – JMK
    Commented Dec 11, 2013 at 16:44
  • 2
    @ʞunɥdɐpɐɥd I don't think that Scott's edit was really that bad. Commented Dec 11, 2013 at 16:44
  • Related (to the formatting issue, not how to handle the other user): meta.stackexchange.com/questions/133224/…, meta.stackexchange.com/questions/131104/… Commented Dec 11, 2013 at 16:58
  • 3
    Just for clarity is this the multi line braceless if vs the multiline braced if? If so I'd say editing to the usual form (with braces) is fine but if the answer OP really really wants the braceless form I guess let them have it (may come with free gift of a downvote however under "dangerous, if correct, code) Commented Dec 11, 2013 at 17:01
  • How do I interpersonal
    – user1228
    Commented Dec 11, 2013 at 17:07
  • Code formatting is IMO rather important for understanding the code, so I do this also, when it is badly formatted. However, I don't format code just on the basis that I don't agree with the style, even if it doesn't match my preference, as long as it is formatted. Adding missing braces is IMO entirely different, because formatting doesn't change the code in question, and I was always working on the assumption that editing should be neutral.
    – Devolus
    Commented Dec 11, 2013 at 18:06
  • 2
    I might be missing something, but I don't see necessarily that this user "just doesn't care." Commented Dec 11, 2013 at 18:20

4 Answers 4

13

If a dispute arises between two users that cannot be resolved via normal communication, cast a custom moderator flag and explain the situation in detail, and a moderator will... moderate the dispute.

FWIW, code changes are a disputed topic. I feel pretty strongly that users really shouldn't be modifying other people's code at all, but some users feel it is OK if the person knows what their doing and makes their intent clear. Jeff Atwood always viewed Stack Overflow as a big source control system, and wasn't bothered by any form of collaborative editing.

I'm not, however, impressed by arguments that code should follow all best practices, and that editors should feel that they have broad permissions to modify other people's code so that it satisfies their sensibilities for what they think best practices should be. If you strongly feel that another answer is inadequate in this way, the remedy is to post your own answer.

Nor do I think editors should get into edit wars over semantics like this. Moderators do not moderate answers based on their technical veracity, but they can, and will, take action on edit wars. If you feel compelled to change someone else's working code, and they roll back your change, just let it be.

10
  • 1
    Why should code be sacrosanct but words not? As long as you're not changing the syntax (which could itself be the answer to the question) and just formatting it so others can read it then it should be fine. Put another way, badly formatted code is IMO a broken window!
    – Jamiec
    Commented Dec 11, 2013 at 16:44
  • 6
    We've had this discussion many times before. The short version is that computers don't have to read your words. There is almost universal agreement that code should never be changed in a question; the only dispute is whether it should be changed in an answer.
    – user102937
    Commented Dec 11, 2013 at 16:45
  • 1
    I understand that changing some indents to make it more readable without changing the code at all is correct. But I feel that adding brackets to a If statement when it was perfectly working the way it was just isn't correct. Commented Dec 11, 2013 at 16:51
  • 7
    @ʞunɥdɐpɐɥd There is a significant percentage of coders that believes coding if statements like these without using brackets is always incorrect. (i.e. it's a "holy war" issue).
    – user102937
    Commented Dec 11, 2013 at 16:54
  • @TheGrinch I understand but my point is if we allow "some" modifications on the code posts, then where is the limit ? Let me use this exemple again... some users think brackets is easier to read but for me it really isn't but I admit it does the same job.. Can I rewrite the code part in vb instead of C# ? Easier to read for me.. it would also do the exact same job. It's a bit extreme but it shows what allowing users to change things like this could do. Commented Dec 11, 2013 at 16:59
  • 3
    I think it's important to realize that StackOverflow provides us with the capability to make these changes. If they were intended to be restricted, the system would restrict them. Also, an if/else block without braces is widely held to be extremely bad form by a vast majority of programmers. In particular, the existence of the comment inside the else block is slightly confusing without them. The braces don't change the meaning of the code any more than the indentation does. If the original poster subsequently undoes the change, it should be left alone, but no harm or foul was done.
    – jpmc26
    Commented Dec 11, 2013 at 17:00
  • 1
    @jpmc26 If they were intended to be restricted, the system would restrict them. -- You have a lot of faith in computers. There are plenty of things we enforce here that aren't automated.
    – user102937
    Commented Dec 11, 2013 at 17:00
  • 1
    @ʞunɥdɐpɐɥd We don't think it's easier to read (although it may be), we think it's less bug prone Commented Dec 11, 2013 at 17:03
  • @TheGrinch I suppose you're right, although I was trying to provide it as evidence to support your answer. ;) Sorry. That was my poor reasoning.
    – jpmc26
    Commented Dec 11, 2013 at 17:04
  • @RichardTingle I understand that too. So I could go and change every bit of code that I find might be harmful ? No more SELECT * or else... I'm not dumb, I understand why the editor made such an edit. I just think it is invalid to fix someone else's code to put it in a way you think is better. Also I woudn't have minded at all if the editor asked the OP about it before editing. Commented Dec 11, 2013 at 17:07
11

I don't think that the user you've posted about did much of anything wrong at all

all he really did was add formatting and fixed a trivial syntax error in an answer, which really isn't that big of a deal.

The reason why some people are weary of edits to code is because it is littered with pitfalls, and the danger of substantially changing the nature of the post is high.

In this case the changes were so simple, that they pretty much avoided those pitfalls.


This brings me to another issue. Once you take an idea that you perceive to be "community consensus". not modifying code in answers is just one example, and you strictly enforce that on everybody, you've just taken the control away from the community.


And one more comment on this issue. While the editor did make his edit which was partially rolled back by the OP, he did respect the OP's final decision. he did not engage in an edit war like I've seen some other users do. That looks like good behavior to me.

11
  • So it is ok to change a perfectly working If statement to add you brackets right ? Because I personally don't use them and I would be pissed if someone would edit my post to put some in there. That's the invalid edit part in my opinion. Commented Dec 11, 2013 at 16:50
  • 7
    Wait, what? If you're not going to enforce community consensus, then why bother having it?
    – user102937
    Commented Dec 11, 2013 at 16:52
  • 3
    @ʞunɥdɐpɐɥd Many users will use this piece of code you have rolled back, and add statements under the if, or else block, and wonder why it doesn't do what they thought it would do. I think braces add clarity, and do not change what the code does.
    – Laf
    Commented Dec 11, 2013 at 16:53
  • @TheGrinch community consenses is typically enforced by peer pressure, not pedantry Commented Dec 11, 2013 at 16:55
  • @Laf First, I didn't rollback anything I wanted to discuss it first. The OP did. If it was my post I would have done the same. I might as well go on someone's post and say I rewrote your code in VB it does the same thing but it looks more readable to me ! Commented Dec 11, 2013 at 16:55
  • @ʞunɥdɐpɐɥd If you place a random section of VB code into what is otherwise a c# code file, does it compile? Commented Dec 11, 2013 at 16:58
  • @SamIam Ok so the limit here is the code must still compile ? So I can change pretty much all the syntax I want as long as it compiles right ? Commented Dec 11, 2013 at 17:01
  • 1
    @ʞunɥdɐpɐɥd - I would generally agree that editing code should be avoided, but you've picked a particularly poor example upon which to build your soapbox. The changes were extremely minimal. A couple brackets did not change the meaning of the code, and adding a semi-colon where one was clearly intended was good, in that it made the code correct. I think you could find a better example upon which to build your case.
    – JDB
    Commented Dec 11, 2013 at 17:17
  • @JDB I think users answering my question here have difficulty understanding that I do not post this because I think the edit ruins the code. I post it because I want to know to what extend can you go and add your personal formatting preferences to another user's code. If I feel using var is dangerous can I remove all var and replace them with the proper type call ? If I feel using SELECT * is bad practice, can I go on SO and remove all the SELECT * I see and add the column names ? Commented Dec 11, 2013 at 17:19
  • 3
    @ʞunɥdɐpɐɥd: You can try it once. If the poster rolls back, I think you have to respect their intent. Post your own answer, with the "correct" code.
    – user102937
    Commented Dec 11, 2013 at 17:24
  • @ʞunɥdɐpɐɥd - If the meaning and behavior of the code isn't changed, then what's the problem? The danger is that seemingly trivial edits can cause very different behavior, so editing code should not be taken lightly. Ultimately, though, the community and the OP have the opportunity to weigh in and decide if the edit is trivial or not. Why not take it on a case-by-case basis, rather than trying to apply a one-size-fits-all approach? In your linked example, I would call the change very trivial. The OP edited out the brackets, but kept the semi-colon (not a true rollback). Case-closed?
    – JDB
    Commented Dec 11, 2013 at 17:24
7

Be careful about attributing motives to other people, particularly when they disagree with you.

Yes, I know, it's easy and fun for the whole family. But it can turn what should be a productive discussion into something else.

Disputes over editing have a long history on Stack Overflow. Ultimately, the arbiter of what is an allowable edit is the original author of the post being edited. So remember:

Do not fight an edit war over a crumb of bread — there’s nothing there worth fighting for! It’s easier to just move on and get work done than create pain all out of proportion to the importance of the individual edit.

The same guidance goes for comments surrounding edits as well.

1
  • 1
    You're right. I implied I was right and it turns out I wasn't. Commented Dec 11, 2013 at 18:28
2

Where there is a clear coding practice it seems fair to edit to incorperate that in an answer in the first instance (i.e. without asking). Including braces in multiline-ifs seems to come under that bracket.

Where the OP disagrees with such an edit (they have their own standard) I think their decision should ultimately be respected. A brief discussion is always a positive way forward but extended debates are unlikely to produce useful outcomes.

If the OP ultimately disagrees with the edit then they should have the final word on matters of style. Of course your vote is your own if you consider the answer to be in a dangerous form without the edit (as I might consider an answer that contained multiline-braceless-ifs to be, especially if nested)

23
  • I agree with you but I have two comments. The if wasn't multiline. And what is the limit of such edits ? Commented Dec 11, 2013 at 17:17
  • 1
    What clear coding standard would you be referring to?
    – user102937
    Commented Dec 11, 2013 at 17:17
  • 1
    @ʞunɥdɐpɐɥd Isn't it, even here in version 1 it is in multiline form. Commented Dec 11, 2013 at 17:19
  • I disagree that there is a clear coding standard in this case, but +1 for giving the OP final say. They get notified of the change. If they feel it's substantially changed the meaning of their code, then let the OP decide. Arguments between two users over style versus disputed "editing rules" (where the changes in question are particularly trivial) is pointless and a waste of time.
    – JDB
    Commented Dec 11, 2013 at 17:20
  • @TheGrinch Well that is always the thing, which is why I think the OP should ultimately be respected. But it seems silly in the first instance to create a duplicate answer over a matter of style when the answer author may be perfectly happy with the (in the editors mind) more conventional form Commented Dec 11, 2013 at 17:21
  • 4
    Users shouldn't be making edits to change perfectly appropriate and readable code into code that users their own personal coding standards, because then someone else with a different set of standards will come along and change it again, and someone else change it again, and then someone else change it back, and it'll never end. For something like this it shouldn't matter whether you'd include the braces or not, you shouldn't be editing another post to use your personal preferences over theirs.
    – Servy
    Commented Dec 11, 2013 at 17:21
  • @RichardTingle My bad. It was. But still. What is the limit ? Can I go on StackOverflow and remove all the var I see and all the SELECT * in SQL queries ? I know the user might think it is bad practice. I dwould understand in a comment explaining that to the user in fact I highly encourage that. But I would like to know what are the limits of these personnal choice edits Commented Dec 11, 2013 at 17:23
  • @ʞunɥdɐpɐɥd I'm not sure I'd be able to come up with a rule here and now that would cover all situations Commented Dec 11, 2013 at 17:25
  • @ʞunɥdɐpɐɥd p.s. not that it strictly speaking matters but I strongly support the single line braceless if as an acceptable compromise Commented Dec 11, 2013 at 17:26
  • @RichardTingle I would. Don't change users code. Propose it in the comment. it is pretty strict yes, but at least it closes the door to people that change that simply because they prefer it that way. Or mistakes and error in the code because we allow "some edits". Commented Dec 11, 2013 at 17:26
  • @Servy - The difference here is that the code was demonstrably wrong in that it omitted a semi-colon. The user edited it in (to make the code correct) and, in the process, tossed in a couple brackets to make it easier to read and/or maintain. The OP then edited the brackets out, but kept the semi-colon. I don't see the problem in this case. A one-size-fits-all rule is difficult to formulate and enforce.
    – JDB
    Commented Dec 11, 2013 at 17:28
  • @JDB It is a fair point, I tend to change these things only if I'm changing other things as well (usually a complete lack of indentation) Commented Dec 11, 2013 at 17:29
  • 1
    @JDB You may not see a problem with users editing another person's answer to be in line with their personal coding standards, but I do. I don't see how making an acceptable change at the same time makes such a change appropriate; in my eyes you shouldn't be making such style changes at all.
    – Servy
    Commented Dec 11, 2013 at 17:35
  • 1
    @RichardTingle I agree, which is why I wouldn't take code that is readable and change its indentation patterns to be in line with my personal style; I make an exception for code that's indentation is so bad that it makes the code completely unreadable, i.e. when there is no indentation at all. I don't consider omitted brackets here to make the code "completely unreadable".
    – Servy
    Commented Dec 11, 2013 at 17:39
  • 1
    @JDB I agree that I don't see this happening all that often, and because it's done all that often, it's not a major problem for the site. If we were to start encouraging such edits and make it known that they were appropriate then they'd start being done more often, and it would become a problem.
    – Servy
    Commented Dec 11, 2013 at 21:57

You must log in to answer this question.

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