34

"Unclear what you're asking" now links to a Stack Overflow-specific page in the Help Center.

I've populated this with guidance that I've found helpful when responding to folks who've hit the quality-ban... But it could use some love. Please edit or comment on the answer below if you can think of a way to make this more useful for folks who are struggling to ask a good Stack Overflow question.

See also: Can we create a Help Center topic that outlines what a SSCCE / MWE means for Stack Overflow?

3 Answers 3

41

How do I ask a good question?

Stack Overflow depends on volunteers. The better your question, the easier it is for those volunteers to find an answer to your problem.

  1. Try to solve the problem yourself; search first
  2. Summarize the problem, including anything useful you found
  3. Provide the shortest code that reproduces the problem
  4. Review your question before you post it
  5. Be an active participant

Search for Solutions

Often asking a new question on Stack Overflow isn't the quickest way to get an answer. Get a cup of coffee, take a walk around the building, and try solving the problem yourself again. If you're still stuck, try using a search engine, checking the official documentation, or searching on Stack Overflow for existing resources that may solve your problem.

Even if you can't solve the problem yourself, looking for an answer will help you understand the problem better, figure out what sort of solutions aren't working for you, and allow you to ask a clearer question.

Summarize the Problem

The first thing people will read is your title. Make sure that it clearly describes the specific problem you're facing. When you were searching in google for a solution, what terms were you using? If the title is clear and defines the problem, more people will be interested in taking a look and trying to solve it.

The beginning of a question should include a brief summary of the problem:

  • What are you trying to do?
  • What is your desired result?
  • What is actually happening?
  • What if any relevant information have you gotten from trying to fix it yourself and doing searches?

Provide Code to Reproduce the Problem

After people understand what your problem is, make sure that they have the tools to work on a solution themselves. If you don't include any way for them to troubleshoot the issue, you have a far smaller chance of getting a working answer.

The best way to do that is to provide code to reproduce the problem. Make that code minimal, complete, and tested to allow people to get started finding a solution as quickly as possible. Depending on the language, putting a working example on a site like jsbin or sqlfiddle in addition to the code in the question body will help people find an answer even quicker.

Not everyone can access external sites, the links may break over time, and posting questions which include such links but no code may be prevented by our automated quality filter

Review Your Question

Once you've written your question, take a look at the preview before you hit post. Read it as if it were someone else's problem:

  • Is it clear what your problem is?
  • Is it clear what you are looking for the solution to do?
  • Is it easy to reproduce the same problem with only what's written in the question body?
  • Is it formatted nicely?
  • Do you notice any spelling or grammar mistakes?

No question is going to be perfect (you can always edit your question later if you find a mistake), but the better it looks when it's first posted, the more people will take a look at it and try to find an answer.

Participate in the Search for a Solution

Sometimes what you think was clear when you posted it isn't clear to the people looking for an answer. After you post the question, you may get comments looking for clarification, or quick answers suggesting solutions. If one person has a question, it's likely that other people will too, so make sure to edit your question to clear up any misunderstandings based on the comments and let people know you are working with them for a solution.

If your question is a particularly difficult one, it may take some time to get an answer. Don't get discouraged! Keep working on the problem yourself. Sometimes you will find the answer while waiting, and can answer your own question to help out people who run in to the same issue in the future.

Resources

Asking good questions is a skill that takes practice to master. If you want to learn more about writing a good question, take a look at these resources:

11
  • 1
    IMHO, the biggest problems right now are that I spend too much time on titles and not enough on code... And, let's face it, it's wordy as all get-out. It's CW, so if you can fix something just do it.
    – Shog9
    Commented Jan 7, 2014 at 0:30
  • There's a lot here to take in, and as you said, handing someone 2K words isn't likely to be effective. I'll try and take a stab at cleaning this up, where I see it necessary.
    – Makoto
    Commented Jan 7, 2014 at 3:43
  • 3
    Is encouraging people to post links to questions that didn't solve their problem really a good idea? Perhaps I'm too cynical, but I fear that having this as the first piece of advice is going to result in lots of posts of the form I looked at unrelated question and dubiously related question but they didn't solve my problem! Now, here's my code...
    – Mark Amery
    Commented Jan 7, 2014 at 9:19
  • 1
    That's really just a more explicit form of the current guidance, @Mark - which is mostly ignored, of course, but occasionally produces the wonderful outcome of, "I searched and found a few things that almost worked (no links included)"
    – Shog9
    Commented Jan 8, 2014 at 0:29
  • Comments: 1. Mention the notification icon in the top bar, so new users know what that means. 2. Maybe say, "don't be in a hurry to post a bad question", or "just because you want an answer badly, doesn't mean you have to hurry up and post a bad question". Commented Jan 8, 2014 at 10:22
  • ESR's piece isn't universally admired, it should be said...
    – AakashM
    Commented Jan 9, 2014 at 16:56
  • It's actually quite controversial (also bloody long), and hence last @AakashM.
    – Shog9
    Commented Jan 9, 2014 at 16:57
  • 1
    @AakashM: It could do with an attitude adjustment, but it's by far the most comprehensive resource, and accurately describes all the (valid) reasons that new users get rebuffed.
    – Robert Harvey Mod
    Commented Jan 9, 2014 at 17:27
  • @jmac shouldn't that be a separate answer? You kept almost none of the old text or tone. Commented Jan 10, 2014 at 17:04
  • 1
    This text goes to great lengths to avoid the word "research". Commented Jan 11, 2014 at 9:40
  • TL;DR - Nice post, but way too long for first timers, the too-busy-to-follow-the-rules people, the can-barely-spell folk, and the no-code/plz-gimme-coders. Imagine a downsloping exponential, that's the fallout vs words effect. One saving grace: the headings look useful if read by themselves.
    – Paul
    Commented Jan 12, 2014 at 10:00
16

enter image description here


Help us to help you

We don't know anything about your problem, please explain it carefully.

What is wrong?

In the title of your question, try to tell us what the problem is.

Examples: Examples of good/bad titles

What are you trying to do?

In the text of your question, before any code, start by telling us what you want your code to do, then tell us what is going wrong (for example, any error messages).

Examples: Examples of good/bad code

Work on your code

If you can, try and reduce your code sample so that it only shows the part where the problem is. If you already have an idea where the problem is, try to write a small code sample that shows just the problem. If you don't know, you can try to find it by removing bits of code until the problem disappears.

This is hard, but if there is less to read, more people will look at your question.

Help us to help you

If people ask you for more information in comments, answer them. You can also update your question to make it easier to understand. Other people may also modify your question: they are trying to help.

8
  • I like your examples. Consider structuring them as images (to allow for space-saving side-by-side good/bad examples) and integrating them into the accepted answer.
    – Shog9
    Commented Jan 9, 2014 at 17:22
  • @Shog9, I don't see quite where you're thinking I would put them?
    – Benjol
    Commented Jan 10, 2014 at 5:35
  • Sorry, @Benjol - got in a hurry and made that unnecessarily confusing.
    – Shog9
    Commented Jan 10, 2014 at 23:20
  • I liked this one better than the top, because it is shorter and more to the point. Thus +1
    – Paul
    Commented Jan 12, 2014 at 10:13
  • 1
    @Shog9, have you (SE), ever done any A-B testing of this kind of thing? Rather than debating for ages, you could just throw up the two top voted texts, and see what the results are. I guess that if there's no way to quantify success, this whole question may be moot...
    – Benjol
    Commented Jan 13, 2014 at 9:28
  • @Shog9. PS: Your comment doesn't figure in my inbox, but user137487's does. Weird?
    – Benjol
    Commented Jan 13, 2014 at 9:31
  • Quantifying success is the tricky bit, @Benjol. I've been looking at edits made post-closure as a rough metric - "Unclear" had something like 20% being edited already (vs. < 10% for "minimal understanding") - I'll be watching to see if this gets better or worse with the added guidance and rolling in edits as time goes on.
    – Shog9
    Commented Jan 13, 2014 at 10:43
  • I wish I could upvote this answer, I think it's really good :)
    – Benjol
    Commented Jun 12, 2014 at 5:30
2

Suggested change to close-as-unclear

This is the current "unclear"

Unclear what you're asking.

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking.

Suggested Insert at this point:

Please edit your question. Help others help you by including information requested in comments, such as: adding demonstrations of previous attempts, providing missing source code, exact error messages, results of additional tests, or adding a link to a code sandbox. This will help others to see the issues, so that they can help you. To edit, click your post's EDIT link located a line below and to the left of the question, then paste in the requested material.

Original (should be kept as well)

See the How to Ask page for help clarifying this question.

When voting to close:

A select could appear to allow for leaving a comment on what is missing. "This question is unclear because it is missing: ". Some of these comments could be prefilled, e.g. needs source code, or needs exact error messages or stack trace, etc. However, no matter the comment, the reason for close would be simply 'unclear what you are asking'.

Why?

  • need to indicate up front what is wrong and how to fix it
  • only a fraction will read a link on how to write a good question
  • Should be a few sentences at most, and in the close message, to promote reading.
  • OP needs to edit, but often doesn't know how.
  • comments will typically indicate what is missing.
  • buttresses some community standards, such as expecting source code and some previous work
  • leaves it up to the people handling the question to communicate to the OP what is wrong on a flexible case-by-case basis

I have marked this as community wiki. Those who think they can improve the language to be both simple and short are welcome to do so.

4
  • All close banners already contain the language "If this question can be reworded to fit the rules in the [help center], please [edit the question] or [leave a comment]." (where the square bracketed bits are links), but you're right that a bit more specificity might be helpful in the Unclear close message.
    – jscs
    Commented Jan 12, 2014 at 19:52
  • I don't think we should encourage people to post links to off-site source code, on the contrary. Also, people doing that tend to post the code as whole and not just the problematic part.
    – Lundin
    Commented Jan 21, 2014 at 14:47
  • @Lundin As a blanket statement that does not reflect existing practices found on Stack Overflow for some languages. Some languages have effective code sandboxes that OPs will be encouraged to use in comments. Others do not. For example, Javascript questions are expected to include a link to a jsfiddle or similar as well as posting relevant source code into their Stack Overflow question.
    – Paul
    Commented Jan 21, 2014 at 19:27
  • Would it be worth pointing out that code reduction is a powerful debug tool in its own right? Failure to debug is often due to a mistaken prejudice about the location of the bug. In that situation, code reduction will find something else that cannot be removed without killing the bug. Commented Jun 12, 2014 at 13:28

You must log in to answer this question.

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