19

Ok so I answered a question about PHP global variables, and my answer was right to the point and solved the OP's problem. I had two upvotes and the OP accepted my answer. However, maybe 3 hours later (when the question would have been burried deep below the newer ones) I got downvoted like crazy: 5 times in less than 5 minutes.

I am quite upset about this and I am now reconsidering my knowledge about this. I don't understand why I was downvoted because I thought my answer was a good one... My answer almost comes straight from the PHP documentation about variable scope.

Can anybody tell me why I was downvoted that much? Was my answer really that terrible? Or is it due to a bug of some sort?

UPDATE: Thank you all for coming to the rescue. I hope that these behaviours will be greatly penalised because they are very inappropriate. Given the fact that my answer was good, regardless of how I demonstrated it, it does not deserve this kind of viral downvoting.

UPDATE #2 : Ok guys, I never thought that I would create such an event with this, I only wanted to know what happened and why I was so massively down voted. It was not meant to be some kind of Pleeeeeaaaase can you give back that precious reputation to me?. Sorry if it felt like that! Now I understand why my answer was downvoted and I updated it to point the OP to better practices.

31
  • 2
    even other answer is downvoted even though comment say That worked great! by the OP Commented Jun 5, 2012 at 12:56
  • 5 downvotes in about 3 mins..serial downvoters? Commented Jun 5, 2012 at 12:57
  • Serial Downvoting Troll (SDT in short... reminds you of something? ;)) Commented Jun 5, 2012 at 12:58
  • This would not be "serial" down voting, as that refers to a single person voting on a single other person's multiple posts. This would be more like some sort of collaboration, perhaps fraudulently so. The number of down votes in that short a time seems a bit odd, yes. Commented Jun 5, 2012 at 13:01
  • 14
    It was linked to from the PHP chat room around the time you said these votes came in...
    – Jeremy
    Commented Jun 5, 2012 at 13:01
  • @JeremyBanks I am always forgetting the vote-getting power (positive or negative!) of the active chatrooms! Commented Jun 5, 2012 at 13:02
  • @JeremyBanks : It's funny how this link in the chat room makes fun of the OP, yet it's the answers that have been down voted... Commented Jun 5, 2012 at 13:03
  • 4
    If a downvote is warranted, fair enough. But is it really appropriate to go into a chatroom and ask for downvotes? Sure enough it might have happened "organically" anyway, but something about this strikes me as inappropriate.
    – Bart
    Commented Jun 5, 2012 at 13:07
  • 9
    PHP developers sure are a contentious people.
    – a cat
    Commented Jun 5, 2012 at 13:08
  • 1
    @lunboks Say that on ProgSE, I dare you. ;P
    – yannis
    Commented Jun 5, 2012 at 13:15
  • 1
    Many programming communities are singling out random language features and demonise them. It usually starts as useful newcomer advise, but qickly escalates into unreasoned coding prohibitions. And your answer just happened to sting into one of those memes.
    – mario
    Commented Jun 5, 2012 at 13:21
  • 1
    @mario Yeah, that's what I was thinking. On a side note: Does the current vote total on that answer mean meta > chat? ;) Commented Jun 5, 2012 at 13:23
  • 11
    @AndrewBarber Meta has come to the rescue on your post's votes Hm, I'd hope that's not the case, because we'd be doing exactly what the PHP chat room is doing, only in reverse. And if we are, we are even more wrong that them, as at least they can claim that they can evaluate the answer, being the PHP room and all...
    – yannis
    Commented Jun 5, 2012 at 13:34
  • 3
    Marco now that I read the answer, I down voted it and Bracketworks beat me to a comment (which I upvoted). Please don't point people, especially noobs, to using global, it's an extremely bad habit.
    – yannis
    Commented Jun 5, 2012 at 13:38
  • 7
    @AndrewBarber I think it's fair to say that avoiding global state is a reasonably language agnostic best practice that long pre-dated the question/answer.
    – Dan Lugg
    Commented Jun 5, 2012 at 13:40

6 Answers 6

24

This appears to have come from a chat discussion. I am genuinely dismayed that if somebody did think there was a problem, they didn't leave a comment. I will be having words with a few folks...


Discussion has been had. This apparently stemmed from people trying to be proactive in quality monitoring, close-votes, delete-votes etc. I have reminded the people involved of the importance of leaving feedback (comments etc) in the case where something is questionable. And made it clear that "pile on" downvoting would be inappropriate.

In this particular case, meta has already boosted that answer a lot; now - I'm not a PHP person. For all I know there is something wrong with the answer. Or maybe there isn't - I'm not qualified to say. Maybe someone will offer better opinion than I can on the technical merits of that answer.

21
  • Totally agree - this chat room silly "dev-pls" reminds me of dark circle shooting flames at will and causing havoc. Far from the way Q&A site should work! Commented Jun 5, 2012 at 13:11
  • @ShaDowWizArd agreed+1. I think the anonymity of votes is important, but this sort of behavior harms that. That said; the instigator of the dv-pls isn't so anonymous, anymore. heh Commented Jun 5, 2012 at 13:13
  • @Andrew true, the identity of the one sparking the flame is known hopefully Marc's words will have a positive effect. :) Commented Jun 5, 2012 at 13:16
  • 2
    @ErnestFriedman-Hill The problem is not so much with the individual who happened to dislike this answer, but that this is common behaviour in some of the more active chat rooms.
    – yannis
    Commented Jun 5, 2012 at 13:17
  • 2
    @YannisRizos That's a good point, too. I think outright asking for down votes smells. I would personally even be loathe to link and outright criticize; I would prefer to link and ask, rhetorically, "What do you all think of this answer?"... but I'm not active in chat enough to even want to do that! Commented Jun 5, 2012 at 13:19
  • 10
    There is something wrong with the answer.
    – Pekka
    Commented Jun 5, 2012 at 13:38
  • 2
    There is something wrong with the answer and the question. MVC, global, really? Commented Jun 5, 2012 at 13:41
  • 7
    The problem is not the downvoting, the problem is the lack of a comment about the reasons of the downvotes!
    – markus
    Commented Jun 5, 2012 at 13:42
  • 5
    @MikeB Yes, we don't require comments explaining downvotes, and that's a good thing. However, what we had here wasn't a single unexplained downvote, but a chat room ganging up against an answer. We don't require an explanation because it's almost always certain that the next person or the person after that will explain what's wrong, and it's incredibly sad to see a wrong(ish) answer being dropped in a chat room full of people and noone bothered to explain what's wrong with it.
    – yannis
    Commented Jun 5, 2012 at 13:57
  • 1
    @YannisRizos So we don't require explanations on downvotes.. unless its excessive?
    – Mike B
    Commented Jun 5, 2012 at 13:58
  • 9
    @MikeB No we don't require explanations even when it's excessive. That doesn't mean that it's not completely crappy behaviour though.
    – yannis
    Commented Jun 5, 2012 at 13:59
  • 3
    @YannisRizos That's my point. Rules are made to curb crappy behavior... but there's so much wiggle room here that the rules are extremely weak. Take this entire post.. it's been a firm 'rule' for a while that you don't complain about downvotes. Yet this guy gets almost a full day's rep because he was actually right to complain in this situation? Since all the mods also emphasize the anonymity of downvotes the community is forced to react in a way it shouldn't. Instead of removing the errant-votes or whatever people decided to off-set them by upvoting instead.
    – Mike B
    Commented Jun 5, 2012 at 14:11
  • 3
    @YannisRizos just because something is requested to be dv'ed (which very rarely happens in the chat) it doesnt mean we jump at it like rabid dogs. With currently -7 it is hard to believe that all these are from the chat regulars (I know I didnt dv it). I'm not saying it wasnt us (I cant check the database) but just assuming it must be us is pre-sentencing us.
    – Gordon
    Commented Jun 5, 2012 at 14:27
  • 1
    @TimYiJiang So what that it's wrong? If the site doesn't have the facilities to punish negative behavior then why should anyone care? We obviously can't rely on people to 'do the right thing' which would have been leaving a comment in this case. Instead of having the community correct itself a diamond mod has to 'have words with folks' to correct the situation where all indications say that Noone did anything wrong.
    – Mike B
    Commented Jun 5, 2012 at 14:32
  • 2
    Copying from another comment: Spend some time in the chat room before you judge anything. The php room is one of the most active on the site. It's been active for 1.5 years, with an average of 1.1k messages per day. Out of all of that, there have been a total of 45 usages of dv-pls, with the majority of them meaning delete-vote. A number of mods frequent the room, and none have expressed any lasting issue with our interaction with the community. Don't judge us by an isolated incident taken out of context. Come join us and spend some time before judging our interaction...
    – ircmaxell
    Commented Jun 5, 2012 at 20:38
22

I think that this indicates a deeper problem with a lot of SO answers. The point of the site is not to help individuals, but to help the community. That's why the Not Constructive and Too Localized close-vote types exist. The power of the site is not in helping an individual, but in helping the community as a whole and providing searchable answers to help future users with similar problems. That's how this community thrives.

But that's not what this answer does. It answers the OP's question. Sure. But it does not help the OP. It says why it's happening, but not what the OP should do.

There are three ways to answer any question:

  1. Answer their question
  2. Solve their stated problem
  3. Solve their actual problem

The best answers do all three. But to me, the third way is the most important. If often takes some insight to determine the actual problem, but the actual problem is the most useful to the community. It's the most useful in general...

The answer that's linked in this question originally (before an edit an hour ago) only solved the first way. The stated problem still existed, it was just explained why it happened.

As to the Chat Issues

I actually somewhat agree to the hate on the tag. I think it is a bit much. It does feel like gang mentality taking root. With that said, I think it's worth mentioning that the and tags are really quite useful in helping moderate the site. It raises awareness on questions that really are not constructive for the site, and allows for a better community moderation to take place.

However, there are no scripts or robots. Everyone who votes is still voting for themselves and making their own decisions. Let's not forget that. It was decided a long time ago that people can down vote without leaving a comment, and that it's desired behavior. I disagree with that mentality, but the community decided that. So if that's acceptable (dv without comment), why is this any different?

3
  • 6
    The down votes were not a problem, and, well, it can be argued neither was the lack of explanation. However when a wrong(ish) answer is exposed to a chat room full of people, you must admit it's a bit disappointing no one bothered to explain what was wrong with it. OP edited the answer a couple of minutes after the first comment explaining what was wrong with it appeared, isn't that quite preferable?
    – yannis
    Commented Jun 5, 2012 at 14:51
  • 2
    @Yannis: I do agree there 100%. If I saw it, I would have commented on it (and perhaps down-voted, not sure). But to say that the room is at fault for gang mentality when following the rules (and the explicitly stated behavior or not requiring a comment on a dv at all) seems a bit much to me... But disappointing it is...
    – ircmaxell
    Commented Jun 5, 2012 at 14:53
  • 8
    If there was ganging up, MSO is as guilty as the PHP room (and perhaps even more). It's amazing how easy it would have been to avoid this whole spectacle, with a simple comment saying "globals are icky, DI would be preferable".
    – yannis
    Commented Jun 5, 2012 at 15:08
15

Just to complement Marc's answer from the point of view of someone who actually has some knowledge of PHP:

The original answer (which was later edited) was correctly describing scoping in PHP, but proposed to solve the problem by importing global variables into the function. This is considered very bad practice (at least in PHP).

As such the downvoters probably decided that the answer is "not useful" (the definition of a downvote): Even though it does answer the question in some way, it proposes a very bad solution to the problem, which eventually would cause more harm than good (thus being "not useful").

I don't see any problem with downvoting such an answer and I don't see an issue with showing the answer to other people, so they can decide whether they want to downvote it too (it's their choice!)

By the way, the answer is now edited and warns about the use of globals. So now there is no reason to downvote anymore.

3
  • I'm curious how the community decided that global was bad-practice. I'm not talking about the technical implications of global-scope and whatnot.. I'm more interested in the science behind something becoming 'Good Practice' on StackOverflow and how others would know that. I see the mysql_* functions alread getting negative light and becoming justification for instant-downvoting in the near future. Who decides these things? How does the word get out? How long does the process take? The fact that jsfiddle became mandatory by the community in [js] answers fascinates me.
    – Mike B
    Commented Jun 5, 2012 at 14:39
  • 2
    @MikeB Nobody decides it. People who agree with it being bad practice downvote, people who don't agree upvote. If certain types of answers start to always have a negative score, well, then "the community decided".
    – NikiC
    Commented Jun 5, 2012 at 16:05
  • 4
    @MikeB Just to let you know, the mysql_* functions are getting bad light because the official PHP developers have announced deprecation (it's mentioned here under Feature Comparison > Lifecycle). Commented Jun 7, 2012 at 1:13
12

Whilst I mostly agree with ircmaxell's answer there is an element of our community who live for the self-righteous act of telling anyone and everyone "they are doing it wrong" or "that's not best practice".

Now that's fine and dandy and perhaps they're right enough. But what a lot of folk seem to forget is that a large number of developers are working in maintenance mode with code bases that cannot possibly be fixed by a complete rewrite to satisfy the pedantic expectations of righteous few - i.e. stop using global variables.

The accepted answer (in it's original form) directly "answers the question" and explains the mechanics of global variables which is the desired result, whether that fits with so-called "best practice" or not is neither here nor there.

Hijacking posts to turn them into "best-practice" flamewars is not constructive, and if the OP bloody well wants to use a global then let him/her do so; step off your high horse and find something else to answer.

In the C# world there are many classes within the framework that implement the disposable pattern and there is a typical pattern of using these classes so as to ensure early cleanup of unmanaged resources wrapped by managed code, for example:

using(UnmanagedResource res = new UnmanagedResource())
{
   // Do stuff
}

Now if a user either asks a question or posts an answer but didn't properly wrap an objects usage in the using statement we sure as hell don't go diving off the deep end yelling about "best practice", gang downvoting and generally derailing that particular question or answer. All that's needed is a polite comment pointing out the error of their ways.

This whole episode comes off as a great big Well, Actually which is sad because our community can be much better than this.

9
  • 3
    If that's the case it is of the utmost relevance for OP to explain that. Commented Jun 5, 2012 at 15:13
  • 8
    And what happens to hobbyist programmer Joe who is just starting out in PHP? Joe doesn't understand variable scope, but sees this accepted answer and thinks, "oh, great I can just make everything global." There's a difference between not using best-practices and breaking one of the first rules of functional programming.
    – rdlowrey
    Commented Jun 5, 2012 at 15:15
  • 3
    @rdlowrey a suitable comment underneath, along the lines of "of course, if you can get away without using globals, that would be better" would fix that. Or even "@poster: perhaps you should include a line about avoiding globals where possible". Even better would be a comment with a link to a resource explaining that - for example another SO answer, or a blog post.
    – user142852
    Commented Jun 5, 2012 at 15:19
  • 2
    And actually, a comment asking the OP: "do you have to use globals?" (provided it wasn't repeated 26 bazillion times) might pave the way for an answer explaining various better ways this could be achieved.
    – user142852
    Commented Jun 5, 2012 at 15:22
  • 7
    Or, use the downvote button. That's what it's for.
    – rdlowrey
    Commented Jun 5, 2012 at 15:24
  • 2
    Oh I'm by no means against downvoting, I was simply suggesting a way of finding out if there was no other choice but to use globals (and educate users in passing, too). Unfortunately, this does happen. Some of us have no choice in the matter :(!
    – user142852
    Commented Jun 5, 2012 at 15:28
  • 8
    Your answer is assuming the wrong situation. The question stated: "I'm working on a MVC-like super-simple framework for an application." There is no: "maintenance mode with code bases that cannot possibly be fixed by a complete rewrite" to consider. Fight pedantic where it should be fought (in questions that relate to maintenance of legacy code). You are merely fighting for wrong answers to trivial questions.
    – Paul
    Commented Jun 5, 2012 at 15:32
  • 2
    @Paul I use PHP (I modify/write custom code for our in-house monitoring system - Centreon - which is entirely written in PHP, I also lead a development team that also uses PHP) and we keep this fine article to hand at all times - me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design - My point is, why not do something constructive and hound the PHP core devs to get their own house in order instead of hunting down and vilifying users for even thinking about using a global variable. There is a huge gulf between that and the crap we have to live with in PHP.
    – Kev Mod
    Commented Jun 5, 2012 at 16:02
  • 1
    @Kev You act like PHP core developers don't know that there is a problem. And by the way, if you have the time, we could sure use your help as a core developer. Commented Jun 7, 2012 at 1:10
3

I was one of the people who downvoted your answer (as well as the other answer) as well as I am one of the regulars in PHP chat.

Let's start with the why: because the answer basically is wrong. I mean the answer works, but it isn't considered best practice (understatement). The use of the global keyword isn't the way to go and should be replaced by dependency injection.

The sad fact is that the [php] tag has a lot of bad practice or plain wrong answers / questions. I blame the different resources on the internet for a big part for this. Now the really sad fact is that other people see them and use them (without knowing it is wrong). One way of showing this is by downvoting questions / answers.

What happened was the following: we were discussing the question and after that saw answers coming in (with some stuff in it you should "never" do: global keyword). When we see a wrong answer we may indeed downvote. And we may indeed post a [dv-pls] with a link (this doesn't really happen that often).

I should say that [dv-pls] is not a: hey guys look at this, downvote the h*ll out of it. It is rather a way of getting an answer / question in the spotlight for review. All people in chat (who want to) will review it and do with it whatever they want. They may even start a discussion which may convert a downvote to a neutral vote / upvote. Again everyone decides for themselves what somebody does with it.

The only thing what somebody could have done was post a comment on your answer to say what was wrong. Although this is not mandatory you will see that most times a comment will be posted.

People can call bad names on us, however the fact is that we are trying to make this site better by making sure the best answers get the most attention. So imho calling us a jerk circle or whatever isn't really the way to go.

So in conclusion:

First let it be clear it was nothing personal against you. Simply because the answer was wrong in the sense that when other people would use it they would be doing it wrong. It's too bad that no comment was left on the answer (which as you can see is something that will happen most of the time). IMHO the [cv-ring] has it's place here given the cleaning up we have done on this site. But again it was not a: "all forces attack!!!" type of thing, but rather that some people thought the answer wasn't correct and acted on it accordingly.

It was not meant to be some kind of Pleeeeeaaaase can you give back that precious reputation to me?

I didn't think it was. But rather you wanted to know why all the downvotes which is a valid question. If you (or anybody else) have any more questions feel free to join the php chat room and you will see we are not the army of downvote fanatics ;) you people think we are. :-)

18
  • 13
    Col. Shrapnel would be proud.
    – user102937
    Commented Jun 5, 2012 at 14:40
  • 9
    And for the record, pile-on downvotes are not Chat's purpose. Such maneuvers just distort the voting system. Circlejerk seems like an apt term.
    – user102937
    Commented Jun 5, 2012 at 14:42
  • And do you believe Stackoverflows advise of never using global variables is significantly more sensible than e.g. w3schools advise of using them everywhere? Opposite extreme, so everything is well? Question two, do you know about PHPs actual global variables? $_GET, $_POST, and do you really never use them?
    – mario
    Commented Jun 5, 2012 at 14:43
  • 2
    @RobertHarvey Sorry, but I don't relate to Col. Shrapnel at all. And for the record I've never said they were. But you know that, because you have read my post right?
    – PeeHaa
    Commented Jun 5, 2012 at 14:43
  • 1
    Come to php chat if you want to discuss this please @mario instead of cluttering this post
    – PeeHaa
    Commented Jun 5, 2012 at 14:44
  • 1
    I read enough to know [dv-pls] apparently actually occurred, and I am amused by your apparent attempt to reframe it here as meaning something else.
    – user102937
    Commented Jun 5, 2012 at 14:45
  • 2
    I still have no idea why anyone is explaining themselves when downvotes are anonymous and aren't required to leave a comment. Plead the 5th!
    – Mike B
    Commented Jun 5, 2012 at 14:45
  • @MikeB: I didn't downvote this post. But since you insist...
    – user102937
    Commented Jun 5, 2012 at 14:46
  • 1
    @RobertHarvey The point is to get pile on reviews, the goal isn't to force a downvote (even if thats what the poster thinks should happen). People downvote when they feel answers are poor, globals are a poor answer when you could correct the persons usage to dependency injection. I didn't take part in the downvoting but I would have had I seen the answer originally, though I probably would have left a comment even though its not required. Commented Jun 5, 2012 at 14:47
  • 1
    @Event_Horizon: I don't think that's necessary either. We get enough vote distortion in the system already when posts are Redditted. If the post is important enough to be pile-on reviewed, it should achieve those views naturally.
    – user102937
    Commented Jun 5, 2012 at 14:48
  • 3
    @RobertHarvey I think pile on reviews are more than required on questions that seem to answer a question when really they may be causing more problems in the long run. Commented Jun 5, 2012 at 14:53
  • 8
    If the point isn't to pile on downvotes it may be wise to rename dv-pls to something like review-pls.
    – Jeremy
    Commented Jun 5, 2012 at 14:54
  • 1
    @Event_Horizon: Yeah, I don't get that at all. You only need to say it once. Provide an authoritative link to a blog post explaining the problem, if you think your comment doesn't carry enough weight.
    – user102937
    Commented Jun 5, 2012 at 14:55
  • @Robert Harvey: As a supplement to your second comment, here's some context: chat.stackoverflow.com/transcript/11?m=3993584#3993584 Commented Jun 5, 2012 at 16:21
  • 1
    @Jeremy Banks: [rv-pls] Commented Jun 5, 2012 at 16:22
1

It surprises me that SO people would sacrifice the quality of the site as a resource to protect the feelings of someone who is giving poor advice. If I post a terrible answer I fully expect to be downvoted into oblivion. If there's no penalty for bad answers, you'll have lots of bad answers. It's that simple.

10
  • Aren't you too tanned for bad answers? ;-)
    – PeeHaa
    Commented Jun 5, 2012 at 15:05
  • I agree that there should be a penalty for bad answers, but if no one ever explains why it is bad, then the person will never know why it was so bad and will not learn from his mistakes. Commented Jun 5, 2012 at 15:08
  • 5
    There's a difference between downvoting an answer, and publicizing it so that you can achieve pile-on downvotes. A vast difference.
    – user102937
    Commented Jun 5, 2012 at 15:15
  • 11
    @RobertHarvey I don't think vindictive voting is a good thing, but low-quality answers should be downvoted and downvoted often. Otherwise stack overflow turns into w3schools where bad information is passed off as authoritative.
    – rdlowrey
    Commented Jun 5, 2012 at 15:17
  • 3
    If the answer represents that much peril to the Stack, someone should have just edited it, and been done with it.
    – user102937
    Commented Jun 5, 2012 at 15:26
  • 9
    @RobertHarvey , and here i thought that 3rd part edits, which completely change the meaning, were against the rules
    – teresko
    Commented Jun 5, 2012 at 15:32
  • 1
    So, just answer with whatever you feel like. Don't worry about it, someone will edit it if it's completely off-base and you can just accumulate rep for teaching people how not to program?
    – rdlowrey
    Commented Jun 5, 2012 at 15:35
  • 5
    @rdlowrey Ok, don't edit. How about providing a correct answer instead?
    – yannis
    Commented Jun 5, 2012 at 15:37
  • 5
    @YannisRizos whether someone wants to take the time to provide a better or correct answer is as much up to the member as is leaving a comment to a downvote.
    – Gordon
    Commented Jun 5, 2012 at 17:36
  • 2
    @Gordon Yes it is. But from my past experiences with SO's PHP community, I was expecting a better answer to appear seconds after the question was dropped in the room, which is what happened the one time I came into the room for about the same reasons. No one is saying that the chat room was required to react differently, just that it's a bit disappointing that you reacted the way you (allegedly ;) did.
    – yannis
    Commented Jun 5, 2012 at 17:40

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