70

Sorry for technical details, the question is below.

Many posts tagged spread a wrong pattern: quite a few upvoted or accepted answers recommend to use Camera.open(CameraInfo.CAMERA_FACING_FRONT) instead of enumerating cameras with for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); camIdx++) and checking cameraInfo.facing for each of the cameras.

I understand that the blame is to the large extent on Google. They added the feature to camera API too late, they did not provide a code snippet, the correct code is ridiculously long, and they used confusing integer constants that too strongly resemble the correct indexes. But this is not an excuse for spreading incorrect information.

The question is how to clean up this mess. Should these answers be flagged, or edited, or there should be a comment for each of them, linking to the correct solution? It's a lot of work, and if each such change needs also community verification, and author's consent, it will simply never be done. The infection will spread at a higher rate than the old ones will be fixed

Note that not all questions revealed by the easy search above are duplicates; some, but not all wrong answers are copy/paste; sometimes, these questions and answers touch other topics, sometimes even the answers and simply deleting the answers may be wrong.

15
  • 5
    Whatever you do, don't edit them. Maybe comment with an explanation of what's wrong, linking to how it should be done instead.
    – Cerbrus
    Commented Nov 30, 2015 at 8:50
  • I agree. I found the issue, when I was searching for Camera Torchlight API. There's three ways of doing it in JB,Kitkat+Lollipop and in Marshmallow. I am still working on a proper solution which will work on all those API levels.
    – 0xC0DED00D
    Commented Nov 30, 2015 at 8:51
  • @noob: I am not aware of differences between JB and KK. Actually, since API 9 the solution with the deprecated camera API seems to be straightforward.
    – Alex Cohn
    Commented Nov 30, 2015 at 8:56
  • 17
    You cannot "lie" when you don't know any better. Instead of spreading your wisdom in a meta post, be sure to do it in an [android] question instead. That's what programmers will actually see. Commented Nov 30, 2015 at 9:38
  • 4
    @Cerbrus "don't edit them" - why?
    – CodeCaster
    Commented Nov 30, 2015 at 9:39
  • 3
    @CodeCaster Because you'd be changing code that's at the core of the answer in a significant way that changes how the answer works. Incorrect answers shouldn't be rewritten completely. Just downvote / comment, and add a answer of your own if it's significantly different.
    – Cerbrus
    Commented Nov 30, 2015 at 9:42
  • 3
    I see your point. I'm curious what the rest of the community / moderators think of this.
    – Cerbrus
    Commented Nov 30, 2015 at 9:50
  • 4
    I edited the title to say "misinformation" instead of "lie" as the latter implies intent while the former can be due to not having the correct information. I believe this is a more accurate description from reading the post. Commented Nov 30, 2015 at 12:42
  • 2
    @SuperBiasedMan with your nickname, you should know better ;-) My expletive title was intentional, to draw attention to this problem.
    – Alex Cohn
    Commented Nov 30, 2015 at 12:46
  • 4
    I'm glad someone brought this up - Android tag in general has loads of incorrect info on it. There is currently no way within SO rules to actually fix it. Commented Nov 30, 2015 at 13:20
  • 1
    Relevant meta.stackexchange.com/q/261817/213575
    – Braiam
    Commented Dec 1, 2015 at 3:16
  • Note: what you call the correct way uses deprecated classes...
    – assylias
    Commented Dec 2, 2015 at 13:33
  • 1
    @assylias: I am glad you are asking. It is true that in a few years, all these questions and answers will be obsolete. But this will take a long while. As of the day of writing this comment, almost 75% of devices active on Google Play Store are running Android versions that predate camera2 API. Of the 15.5% devices using platform level 21, many do not implement the new API, e.g. LG G2, or only offer crippled implementations.
    – Alex Cohn
    Commented Dec 2, 2015 at 14:11
  • I don't even understand the answer in the "correct way" example. It appears to me to just duplicate the code in the question. How is the question a real question if it doesn't include code that needs help? How is the answer an answer if it doesn't explain what was wrong in the code in the question? That may be the right way to deal with cameras in Android, but as a Stack Overflow Q&A, it leaves a lot to be desired. Commented Dec 2, 2015 at 17:15
  • @PeterDuniho: you are right, this looks like the same code; if you follow the comments, you find that the OP's problem was likely outside the code snippet that he posted. I didn't link this answer here because it is exclusive or exceptionally smart; I chose the first correct one that my search revealed. My point was not to draw the attention to a canonical answer to a common question, but to a common misunderstanding that is reproduced again and again to answer different questions.
    – Alex Cohn
    Commented Dec 2, 2015 at 18:14

2 Answers 2

84

While Stack Exchange does value "original poster ownership", as in: you as a poster have the last word in what happens with your post, I think that upvoted posts that are distributing outdated or even wrong information should be collectively edited to point that out.

In my opinion downvotes and comments are not enough for this. Googlers see a block of code and a couple of upvotes, and they will copy-paste that code without reading on.

I'm all for having a big fat banner edited into such posts:

This post contains outdated, incorrect or harmful information. See this question here for the proper approach.

Just as shown in How to deal with hugely upvoted, bad and outdated answers?.

We can then also apply this banner to the copy-pasta that keeps introducing SQL injection vulnerabilities.

Banners like this have to be used sparingly, but some cases (like this one) their use is warranted: to prevent future readers from actively performing self-harm by trusting the information in the inarguably wrong answer.

15
  • 28
    I like the addition of the banner as opposed to actually editing the answer's code. That's a nice alternative.
    – Cerbrus
    Commented Nov 30, 2015 at 9:58
  • 4
    Also downvote the answers because they are wrong and harmful. Sometimes a downvote gets the users attention as well.
    – usr
    Commented Nov 30, 2015 at 13:14
  • 5
    ++ for this: "In my opinion downvotes and comments are not enough for this." Commented Nov 30, 2015 at 13:22
  • 2
    "you as a poster have the last word in what happens with your post" This is completely false.
    – bjb568
    Commented Nov 30, 2015 at 14:00
  • 13
    @bjb568 searching the currently valid rules is horrible, but every meta post about editing other people's answers ends up in "The poster is the owner". As long as you don't go against a flaggable rule (entirely off-topic or offensive answer), you as an OP are allowed to roll back any edit done to your posts. So humor me, try to find a meta post (preferably by a mod) that contradicts that. In any way, I may have got a detail wrong there, but that statement is not "completely false".
    – CodeCaster
    Commented Nov 30, 2015 at 14:08
  • 1
    @bjb568 not saying that I agree with that, though, let that be clear. I'm all for editing all posts into their best shape including modifying code and adding explanations where appropriate, but that's not what the consensus seems to be. Or if it is, people should stop posting contradicting answers to meta.
    – CodeCaster
    Commented Nov 30, 2015 at 14:13
  • 2
    One question is, or perhaps should be, how can we get people to stop copying and pasting code from the internet into their applications? ;) Commented Nov 30, 2015 at 15:44
  • 12
    @Mike shut down the site.
    – CodeCaster
    Commented Nov 30, 2015 at 15:45
  • 1
    @CodeCaster "to readers... it shouldn't look like you introduced something that wasn't there in the mind of original author. As opposed to say, Wikipedia, Stack Exchange posts are attributed to users, their profiles and avatars are typically displayed under the posts..." (Editing Philosophy)
    – gnat
    Commented Nov 30, 2015 at 21:19
  • Yeah, @gnat, that's one of the posts that show what the current stance is. Whether that's maintainable in the long run, or that we need "curators" (so people who are allowed to edit a post's meaning, because it was wrong to begin with, or has become outdated) is a different story.
    – CodeCaster
    Commented Nov 30, 2015 at 21:23
  • 2
    While I agree that just downvote and comment might not be enough, I think a comment asking the OP to correct the answer should be left before a banner is edited in. In my opinion banners should only be used when the OP is absent or otherwise unwilling to fix the problem.
    – Anders
    Commented Dec 2, 2015 at 10:57
  • Here is an example: stackoverflow.com/questions/109383/…
    – assylias
    Commented Dec 2, 2015 at 13:27
  • 6
    Googlers see a block of code and a couple of upvotes => (1) what was the last time you checked the number of downvotes on a post (rather than just reading the total), (2) it's a privilege, so actually most users cannot even check whether there are a couple downvotes or not... so indeed, most users coming from Google will not even know there were downvotes on the answer. The banner is visible to all, without effort, much better. Commented Dec 2, 2015 at 13:39
  • 1
    @Matthieu of course I meant "and see a positive score". Personally, I click the score on almost any post I read.
    – CodeCaster
    Commented Dec 2, 2015 at 13:46
  • IMHO, this is a reasonable approach (add a banner). But I also feel strongly that the redirect should lead to an answer that not only explains the correct way, but also explains why this "oft-repeated misinformation" is the wrong way. Commented Dec 2, 2015 at 17:16
-6

Perhaps upvotes related to API discussions should have expiration dates (1 year?). As new people find the information useful, they will upvote it and the counter will remain relatively high. As the information gets stale and nobody is finding it useful, older upvotes are removed until eventually it reaches 0. If a better answer is added later, it will eventually percolate to the top regardless of how many upvotes an older worse answer got. Provide an option to allow people to ignore the expiration date for cases where they think the old answers are still relevant.

A simpler option is to just have an expiration based on the most recent upvote. If nobody has upvoted an answer in a year, then set it to 0.

2
  • 6
    Thing is, I bet some of the wrong answers just happen to accidentally work, and people will keep upvoting them (after copying-and-pasting the code into their program). Commented Dec 1, 2015 at 1:29
  • 4
    I agree that a feature that would show the aging of upvotes may be helpful. The big problem is that the speed of such aging may be not uniform across different topics. The small problem is to make it visible enough, but keep the UI clean and simple. But this feature could not help in the case that triggered this discussion.
    – Alex Cohn
    Commented Dec 1, 2015 at 7:11

You must log in to answer this question.

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