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
-gflag, which tells the compiler to leave information used by the debugger. Then run your program in gdb, e.g.
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.