Don't get me wrong, I'm one of the front-runners for wanting people to show what they've tried.

But I feel like showing what you've tried, all too often, turns the question into "What's wrong with my code?", as opposed to "How do I do this?".

Similarly with the answers - if asked what's wrong with code, often a partial code sample is given pointing out mistakes with corrections, or an explanation in words. (This does actually make sense at the time of providing said answer, as we don't really want to give users copyable code to their homework, and often the code is long and will just clutter the answers.)

Now every now and again I look for ... stuff (mostly to find a duplicate of a question) - often I just find the above on Stack Overflow - non-working code in the question and partial code samples or just explanations in the answers. Personally I'd much rather go looking for a reference that has a complete working program.

Not to mention that "What's wrong with my code?"-type questions don't make for particularly good references / duplicates, even if the answer is excellent, it can only do so much - it still has to answer the question, and the question with the non-working code is still on the same page.

So, some questions:

  • Is Stack Overflow going in the right direction with this approach?
    (as many of these types of questions aren't particularly useful, as explained above)

    • If we are not, are there viable alternatives?

    • If we are, can someone try to put my concerns to rest?

  • Would improving this perhaps just require some commitment from answerers to provide complete code samples? (What about the copyable code / clutter clauses above?)

  • Should "What I have tried" perhaps be a temporary thing - we encourage / enforce separating that part from the rest of your question / answer (where possible), and after some time, we edit these parts out of questions / answer?

  • 3
    I think the "Show us what you've tried" is taken way to literally. The purpose is to force users to make an effort and do research before running a website and asking for help. But the fact that it is treated like "I'll show you mine if you show me yours" is a problem. Commented Nov 8, 2013 at 16:31
  • @psubsee2003 Isn't "I'll show you mine if you show me yours"-type questions more along the lines of what we want? Commented Nov 8, 2013 at 16:33
  • 2
    Yes and no. Personally, I think all we want good, well researched questions that are well written. So do you have to explicitly spell out what you tried? If your question is written in such a way that you know someone didn't even make an effort, then absolutely. If you don't explicitly spell it out but you can tell by reading it that there was real effort put into it, then you probably don't need it. Commented Nov 8, 2013 at 16:38
  • Robert Harvey has expressed a similar sentiment in Are code troubleshooting questions really what we want to encourage? Also related is How does proof of effort make a question better?
    – jscs
    Commented Nov 8, 2013 at 20:25

1 Answer 1


It's all about how you incorporate what you've tried into the question.

You are correct that a question that says, "Here is my code, why doesn't it Foo the Baz?" ends up fairly localized, and tends to make poor a poor duplicate target.

A question that says, "I need to Foo the Baz. I have attempted to do this by [...] and the code that I am using to do that is [...], but when I try this it [...] instead. How can I Foo the Baz?" An answer to this question might take the OP's code, explain a point of failure, and fix it. It may also say, "that's not the right way to Foo the Baz, just do this instead." The way this question is phrased, such an answer is still answering the question. Such an answer isn't technically answering the first question.

A good way of summarizing this is to say that explaining what you have tried should generally be described in addition to asking an actual question, rather than as a part of the question itself. This prevents the answers from being tightly tied to the given code snippet, but still provides the valuable information about what progress has already been done towards the problem, helps the readers understand what the OP does and doesn't currently understand, and ensures that users don't abuse the help of the community members.

  • 2
    There are some problems with this. First, the title of the question is very commonly "how do I foo the bar?" But the answer is typically "here's how to fix the problem with your code." The resulting hodgepodge doesn't necessarily represent a good solution to "how do I foo the bar," and frustrates Google searchers who think they have found the correct solution, only to encounter a highly-localized troubleshooting scenario.
    – user102937
    Commented Nov 8, 2013 at 16:43
  • 2
    Further, insisting on a complete solution from the answerer that meets adequate coding standards is the equivalent of icanhazcodez, which we typically discourage. I personally would prefer it if people focused on more generalized solutions, but I don't know how to reconcile that with icanhazcodez.
    – user102937
    Commented Nov 8, 2013 at 16:44
  • @RobertHarvey To your first point, if the answer fixes the problem with that code then a googler ought to be able to take the code, apply the fix, and have an answer. To the second, a "solution" need not necessarily involve code. You can still have a quality answer that described how one would go about solving the problem, or that only codes up a particularly difficult/key point without fleshing out any of the details, leaving that for the reader. I agree that deciding where to draw the line between "too abstract" and "does too much of someone else's work" is a hard issue.
    – Servy
    Commented Nov 8, 2013 at 17:33
  • 1
    In practice, it can be difficult to tweeze out the useful code from the troubleshooting exercise. I often solve the Google problem by simply changing the title of the question to the more specific troubleshooting issue (which sort of defeats your described scenario).
    – user102937
    Commented Nov 8, 2013 at 17:42

You must log in to answer this question.

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