I have seen many questions on SO which ask for a tutorial on some specific topic or some functionality. Some users say "this is not a good place to ask for a tutorial" or "hit Google". But maybe some tutorials on different functionalities don't show up without a specific search phrase in Google.

If I encounter such questions, should I discourage the asker from asking such questions or should I post some link as an answer or comment?

Also some users ask for a "sample code snippet". Is it okay to post such a sample or should I say "try something, show us and then ask"?


2 Answers 2


That's colloquially known as a "give me teh codez" question, and generally no, it's not okay.

From the FAQ:

We feel the best Stack Overflow questions have a bit of source code in them, but if your question generally covers …

  • a specific programming problem
  • a software algorithm
  • software tools commonly used by programmers
  • practical, answerable problems that are unique to the programming profession

… then you're in the right place to ask your question!

In other words...

This is good:

I am attempting to do X with the following snippet of code, but I am receiving error Y. How can I fix it?

This is bad:

I don't know how to do X. Can you give me some code?

By all means leave a comment with links to tutorials. Just know that that sort of question is likely to be closed and deleted relatively quickly.

  • The OP asks about questions that ask for link to tutorials and the like (e.g. a tutorial on how to use gdb etc.). That's not the same as asking for code to solve a specific problem.
    – jogojapan
    Feb 27, 2013 at 4:35

You can answer any question you want in any way you want. We don't tell you what to answer and how to answer.

Consider, however, that the community has established what makes an acceptable question and will downvote and close (and eventually delete) and question that is not acceptable.

Questions that are not acceptable are indeed such questions that simply ask for code or for tutorials - in particular those that show no effort by the asker that they have made any sort of research or tried to figure out things by themselves.

As such, you need to ask yourself what value is there for the community, yourself and the asker in simply giving them what they want. In part, this would encourage them to continue with this unwanted behaviour and will not encourage them to go and find their own answers. In terms of the reputation to yourself - even if you gain some from an answer, if the question gets deleted, so will any answers and any reputation gained on such posts will be lost.

All this skirts any issues with the answer itself - it may be a good one and it may be a bad one (we consider answers that are simply links to be bad answers, so those would get downvoted).

  • 2
    Technically we tell you what you can answer by closing things. Tutorial requests/give me the codez are generally closed
    – Ben Brocka
    Aug 13, 2012 at 18:37
  • 1
    @BenBrocka - Technically, yes. But as such, one is free to answer any question in any way.
    – Oded
    Aug 13, 2012 at 18:38
  • I don't think the OP's question has anything to do with "give me the codez" questions. Asking for a tutorial is typically something like what is discussed here: meta.stackexchange.com/questions/139008/…
    – jogojapan
    Feb 27, 2013 at 4:40
  • @jogojapan - It is a resource question and as such should be closed. This is also what the accepted answer on your linked question says.
    – Oded
    Feb 27, 2013 at 9:33
  • @Oded Yes, I agree that it should be closed. But comparing it with give-me-the-codez questions is unfair. A true give-me-the-codez question is an act of utter laziness and usually doesn't give rise to a question that is useful for anyone but the asker, while resource questions are often actually useful -- they just don't fit into the SO format very well because they are open-ended and all that. So yes, they usually need to be closed, but I find it important to explain the reasons well.
    – jogojapan
    Feb 27, 2013 at 13:05

You must log in to answer this question.

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