What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

I've seen a number of questions where the only code posted is code that functions properly.

On that occasion, there will often be a number of users leaving comments stating (and demonstrating) that the code works properly, but invariably there will be another user who posts an answer that effectively states "Works for me" in so many words, accompanied by a link to a code testing site like jsFiddle.

Are these "Works for me" answers considered valid?

The reason I ask is that I flagged such an answer (now removed), but the flag was immediately declined with...

declined - a moderator reviewed your flag, but found no evidence to support it

  • Does this type of answer to a non-question, or to a question that needs more info, satisfy the requirement of being an "actual" answer, even though it doesn't really do anything to help the user with the problem?
  • Was my flag correctly declined?
  • Do you like bullet lists as much as I?
share|improve this question
    
Hopefully you think this answer is ok :) –  Adam Rackis Jan 13 '12 at 19:52
4  
@AdamRackis: I'd consider that to be entirely redeemed in that it's very informational, and is a good (and successful) attempt to make something useful out of one of the many non-questions that appear on the site. –  squint Jan 13 '12 at 20:01
2  
@AdamRackis: Your answer contains a snippet of code accompanied by a detailed explanation of how the code works, and is not merely "This works for me!" with a link to a Fiddle, which breaks all kinds of rules. –  Robert Harvey Jan 13 '12 at 20:02
    
Thanks. Amusingly, if you had 10K rep, you'd be able to see the three deleted answers attempting to explain why the code was broken :) –  Adam Rackis Jan 13 '12 at 20:03
    
@Robert - indeed. And I made my comment before I clicked through to see the deleted answer (pretty bad). amNotIam and I have chatted on JavaScript questions before, so I was only being half serious :) –  Adam Rackis Jan 13 '12 at 20:05

4 Answers 4

up vote 32 down vote accepted

Worth noting: The mod who declined the flag is not the same mod who deleted the answer. Like the Precogs in Minority Report, occasionally we do disagree.

share|improve this answer
1  
Thank you for the info. I was very surprised to see it declined, so I'm glad I asked. –  squint Jan 13 '12 at 19:42
2  
@Robert: I like eggs. –  animuson Jan 13 '12 at 20:29
    
Oh, I forgot to mention that I like Minority Report even more than I like bullet lists. And that's saying a lot considering that I have to endure Tom Cruise for two hours! –  squint Jan 13 '12 at 21:08
    
@animuson: I love the Amanda Show! –  Rocket Hazmat Jan 13 '12 at 22:46

"Works for me" answers should include details of the environment where it was observed to work.

That means:

  • compiler vendor and version
  • compile options
  • link options
  • operating system
  • CPU architecture

For scripts:

  • interpreter and version
  • operating system
  • working directory
  • CPU architecture

For client-side web stuff, it would mean:

  • web browser and version
  • operating system

And a screenshot or shell transcript showing successful run of the code.

share|improve this answer
    
I'd agree with that, but I'd include an explanation of why/how the working code works. I think that if the asker is including working code as an example of a supposed problem, then it would seem clear that the asker doesn't know enough to recognize correct code. In other words, instead of viewing the question as why "doesn't" my code work, it should be viewed as why "does" my code work in order to make these "works for me" answers valid. +1 for the good points though. –  squint Jan 13 '12 at 21:47
    
@amnotiam: If the question asks for an explanation, sure. If it's just "Someone told me there's a problem" or "It's causing problems help me find them" then I would assume it was designed by the question asker and they don't need an explanation (or they can ask for one in comments). And often environmental differences explain differing behavior. –  Ben Voigt Jan 13 '12 at 21:48
    
I think that these questions come from the asker thinking they know enough to reduce their code to a truncated example without the need to test the example. Of course if they knew enough to do that, they wouldn't need to ask in the first place. So many of these are not the actual issue, but are improperly conceived pseudo-examples. –  squint Jan 13 '12 at 21:52
    
...there seems to be a lot of this happening with JavaScript/jQuery type questions, which is where I spend most of my time. –  squint Jan 13 '12 at 21:53
    
@amnotiam: In that case, the community should be telling them (1) test it yourself and (2) if it works for you, you are welcome to ask whether that shortcut/trick is portable. And "works for me" is definitely not an appropriate answer to a question about portability, it's inconclusive (OTOH "doesn't work for me" does demonstrate non-portability). –  Ben Voigt Jan 13 '12 at 21:56
    
Yeah, and that's the problem. Most people comment, but some give a non-answer. If the question is presented as "my code doesn't work", but in reality the example posted does work, some users post an answer that merely says "works for me" (or an equivalent), with a link to a site like jsFiddle. IMO, these are not answers unless the answerer demonstrates in detail that the premise of the question is flawed. –  squint Jan 13 '12 at 22:04

The point of an answer is that it should help the OP to solve their problem.

Clearly, "it works for me" does not do this. All it says is that the answerer was unable to reproduce the OP's problem, and gives no insight into how the OP might be able to actually resolve their issue.

If the OP's problem is not reproducible, it usually means that either they haven't accurately represented their problem in their question (e.g. code snippets don't reflect actual code), or they've left out relevant details. In either case, the correct action is to leave a comment asking for additional details, not posting an unhelpful answer.

I'll always flag such answers without mercy or remorse, and I think you were absolutely justified in doing so.

share|improve this answer
    
+1, though another possible reason not mentioned for failing to reproduce would be an environment difference between the asker and answerer - e.g. different language version, faster PC. Perhaps you're filing that under 'left out relevant details', though. –  Mark Amery Dec 12 '12 at 20:50

I think there's a difference between just saying "works for me" and actually proving that the code is correct.

"works for me" is specific to my environment, there could still be an issue in other conditions (for example a different browser). That's not a complete answer.

Explaining that the posted code is correct is in my opinion a valid answer. It is helpful as:

  1. It tells the OP that it's time to look somewhere else for an issue
  2. It tells the other readers not to waste time looking into the current code, and go help somewhere else
share|improve this answer
    
If the question as stated doesn't actually represent a problem, then the question should be closed. The answer may be helpful in the here and now to the OP, but the page as a whole doesn't need to stick around. –  Josh Caswell Dec 17 '13 at 4:56

You must log in to answer this question.

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