Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 157 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

Going with the example of newbie "help my code is segfaulting and I don't know why" questions. I have partisan biases here - one of a handful of things I don't like about SO is how easy it is to avoid learning when asking questions like this, but on reflection I've come to the conclusion that our current standards cover this just fine: it is possible to write high quality answers instructing on how to solve the user's problem, even by using a debugger. Here is what a high quality answer might look like:

I might be able to find the line of code that has the problem, but here is a more or less assured way to solve it: run your code in a debugger and step through it a line at a time, so you'll see exactly what is actually happening. For C++ or C the simplest is probably gdb. First compile your program with the -g flag, which tells the compiler to leave information used by the debugger. Then run your program in gdb, e.g. gdb a.out.

In your case your problem is you are expecting a variable to change and it is not. I would recommend doing two things: firstly watch the variable via (gdb) watch playerTurn. This will stop the flow of your program when the value does change. This is in particular necessary because it may have changed and changed back. Secondly set a breakpoint on the line you expect it to change, via (gdb) break 123. Then run your program with run. Note whether it is changing where you expect it to change. I expect this will solve your problem, but even if it doesn't you'll probably uncover far more specific behavior to research and it'll be easier to get help with.

Such an answer is:

  • helpful - which already deserves an upvote per hover text
  • likely to solve the problem, which I think is our most important criterion for whether an answer is good. We are looking for solutions and are welcome to proposed solutions that stand a good chance of being helpful, not automatic answers.
  • Exactly how we answer many higher quality questions
  • is not appropriate for comment
  • professional and non-sarcastic. As the answerer I do not have full access to the source code and cannot run in a debugger in myself (or don't feel obligated to help in this way), and do not need to be savvy enough to spot the problem in order to help in solving the issue.
  • if other FGITW users are not playing, it is likely in fact the only expedient way to deliver help to the user.
  • far more helpful for future visitors who may be experiencing a similar problem, just, you know, with different variable names and lines of code and such, and therefore useful even if FGITW players have already answered it.

In particular I quote the answer to the linked question, which stands at +20/-0 votes:

Stack Overflow is a question and answer site. It is designed for you to ask a question that you don't know the answer to, and have someone help you figure that question out. If that answer helps other people, terrific, it will get upvoted. If the accepted answer doesn't apply widely, people can still look at the other answer. That answer isn't just going to run away in fear of an accepted answer.

Anyway, while I feel this case is evident - particularly because my case appeals to how to instruct well, not whether it's okay - a handful of discussions I've had in comments on these answers (admittedly, when I was in the habit of doing this with more snark than I am currently advocating for) have boiled down to "well that's not actually answering the question" / "yes but it's helping solve the question." I would be much more okay with a downvote explaining how such an instructional answer is not helpful enough rather than how it "doesn't answer the question." So I need us to have a clarified stance on how to post these kinds of answers well because the community, including moderators, do not exactly see it this way.

share|improve this question
I've been thinking about this too. A large class of problems would be better solved by 'Do you know how to use a debugger? If you can debug your own code this class of problems is easy to solve' than 'Here's the line. Come back to Stack Overflow the next time you're clueless about how your code works! wink wink' – Patashu May 10 '13 at 23:14
@Patashu that's kind of true for every question at some level though. The point is to be constructive in answer enough to be moving the user to a solution. – djechlin May 10 '13 at 23:15
Exactly what I mean. – Patashu May 10 '13 at 23:16
@Patashu oh I misread, yes that's my sentiment, my discovery in this post was kind of that that's actually consistent with our current standards. – djechlin May 10 '13 at 23:17
Will commented "So, again, please don't add this as an answer to more questions.", which implies you had a duplicate answer flag on this..? you've certainly done it a few time, i.e. debugging tips. – ben is uǝq backwards May 10 '13 at 23:20
@benisuǝqbackwards I know what duplicate(s) Will is thinking of but am contesting that this one is actually a dupe. In writing this post I think I put together what is appropriate about these answers, and taking the time to write something more helpful than "use a debugger" (which is less useful than google searches even) is a requirement. I've admittedly less helpfully suggested to use a debugger before, but I emphasize that in my deleted answer I gave specific advice based on the situation at hand, and it is precisely that specificity that made the deleted answer helpful. – djechlin May 10 '13 at 23:29
By all means contest @djechlin, it was a question :-)! I'm saying that if you posted 3 identical answers then Will's comments make sense and so does the deletion but I can't see your deleted answers so I'm asking. To be honest I'm not really a fan of the "use a debugger" answer but I wouldn't go so far as to flag them. – ben is uǝq backwards May 10 '13 at 23:31
@benisuǝqbackwards nonetheless it's pretty okay to have pretty similar answers, it happens on duplicate questions before closure all the time (which I kind of think is a problem), and the truth is I think if as a community we become good and consistent at not playing spot-the-line and properly generalized "segfault"-ish or "variable didn't update"-ish questions, we could close them as dupes to ones having an answer like the one made up in my question. But to get these in order first requires a consensus on good standards for constructive debugging instructions questions. – djechlin May 10 '13 at 23:34
@djechin, Did a mod delete your response? Or did you delete it yourself? Because I can not see your response, nor any comments appended to it? I suppose I don't have enough rep to be able to view deleted answers yet. It would be helpful for the purpose of this discussion if you could undelete it (assuming you're the one who deleted it in the first place).… – Stephan Branczyk May 10 '13 at 23:39
@StephanBranczyk mod deleted it, I can't undelete. And no, you can't view it due to < 10k rep (and not your own). – djechlin May 10 '13 at 23:41
@benisuǝqbackwards okay I do want to be clear, I don't think Will was off the rocker. It's taken me some "practice" to learn how to do this well and I think he saw an antagonistic pattern (in my last two answers which were both debugging based). I'm more contesting the community logic that all "use a debugger" answers are equivalent and trying to establish a sense of how the usual rubric for quality answers applies to those as well. – djechlin May 10 '13 at 23:43
Ah ok, I didn't realize they did that for these kinds of posts. – Stephan Branczyk May 10 '13 at 23:43
@StephanBranczyk he deleted on "not an answer" grounds, which is standard practice. I disagree and am articulating why it qualifies as a constructive answer in this post. – djechlin May 10 '13 at 23:44
up vote 1 down vote accepted

I recommend this rule of thumb:

  • If you're helping the user research a question and you don't really know what's going on, post a comment.
  • If you have a step to take that you reasonably expect will get the user over the problem, post as an answer.

Debugging advice can fall in the latter category when you recognize the problem as one that is often trivially solved by a debugging step. E.g. if you infer the problem is "cannot find where segfault happens in this C or C++ code," it is appropriate to instruct on how a debugger solves this problem since - and I'm relying on my own C/C++ expertise to assert this - debuggers reveal the exact line with very high fidelity.

share|improve this answer
It's worth noting that if debugging answers don't solve the problem, it's no longer an answer – Emrakul May 12 '13 at 14:42
@KnightswhosayNi right, but that's pretty consistent with how SO works anyway. If you post "your problem is you meant == not =" and the OP says "fixed, still doesn't work," it's the same principle. Yes, the answerer needs to be judicious and fairly strict, and willing to retract if the answer proves to be off base. – djechlin May 12 '13 at 14:48
I feel slimy accepting my own answer that I'll be touting around as a consensus when it doesn't have any upvotes. One more day for feedback. – djechlin May 14 '13 at 15:38
You can also not accept your answer, since it's not really canonical. Place a bounty if you're looking for better answers, maybe? Even though they don't mean much on Meta, you're still going to garner attention. – Emrakul May 14 '13 at 15:47
@djechlin If debugging help as a good amount of code, would it be acceptable to place it in an answer for code formatting? In the past I've seen the answer section used this way and would lead to an answer but in itself was not an answer. – defaultNINJA Jul 24 '13 at 16:57
@defaultNINJA I don't understand what you're saying. "as a good amount of code" and I don't know what you mean by "an answer for code formatting". – djechlin Jul 24 '13 at 17:08
@djechlin What I mean is over 15 lines of code (arbitrary number, but more than 2 lines) to be formatted with proper tabbing and spacing for code readability. Comments are just treated line by line with no formatting available. – defaultNINJA Jul 24 '13 at 17:11
@djechlin such as currentData.sort((function (index) { var mod = desc ? -1 : 1; return function (a, b) { var x = $(a[index]).text(), y = $(b[index]).text(); if (x.indexOf("$") !== -1 && y.indexOf("$") !== -1) { x = x.replace(/\,/g,"").replace(/\$/g,""); y = y.replace(/\,/g,"").replace(/\$/g,""); } }; })(columnIndex)); – defaultNINJA Jul 24 '13 at 17:14
@defaultNINJA I don't know why you're posting that code. – djechlin Jul 24 '13 at 17:39
@djechlin Ok never mind then... I was trying to show a basic example of how crappy code looks in comments. With web development long bits of code are used for debugging and don't look good in comments. Web developers typically don't have easy access, if any access, to a development system that can use a debugger like in C/C++, Java, etc. So leaving long code in a comment to help with debugging doesn't really work. – defaultNINJA Jul 24 '13 at 17:41
@defaultNINJA I see, but no, that would not be appropriate as an answer either. People are rarely that enthusiastic to write that much code that could maybe help someone - usually better to just explain what to try or how to do it. – djechlin Jul 24 '13 at 19:27
@djechlin That works, thanks for the answer! – defaultNINJA Jul 24 '13 at 19:44

You must log in to answer this question.

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