Skip to main content

Problematic types of questions

Remember that Stack Overflow is a Q&A site, not a discussion forum. Your question should be as clear and specific as possible about what the problem is so that an answer to it can be identified and marked as correct. If your question is seeking a conversation, it’s likely not a good candidate for Stack Overflow. The following are patterns of questions that we’ve observed are unlikely to get a good answer, and might be closed as off-topic.

Why doesn’t it work? / What am I missing here?

When questions are phrased like this, it comes across as having put little effort into building a minimal, complete, reproducible example and debugging it. Instead, you should phrase your question to focus on the specifics of what isn’t working the way you expect. Otherwise, the reader might skip the question not knowing what you think the problem is, or vote to close as needing debugging information. A more clear phrasing would be more like this:

Why is it when I call function X, it returns Y instead of Z as expected?

Stating the question like this shows that you have a specific expectation (Z), an observation (Y), and the code that causes it (X). This is a very effective pattern for questions on Stack Overflow.

How do I do X? / I don't know how to do X.

Many questions end up getting phrased like this, but there are two problems you should be aware of:

  • The minimal set of tasks that achieve the final goal of X could be much larger than is appropriate for an answer on Stack Overflow. While the task might seem straightforward to you, it’s entirely possible that the question will be closed as needing focus if the community thinks that it’s actually much more complicated. If you’re looking for a tutorial or general guidance, you should post to a different forum that allows for it.

  • It might be hard to tell from the question alone what exactly you are stuck with. If the content of your question properly contains code and debugging details, then consider rephrasing the question in more specific terms, focusing on the error message or part of the task where you are stuck.

What is the best/easiest/fastest way to do X?

This question reads as if it’s seeking an opinion, which is off-topic for Stack Overflow, and is likely to get closed. In particular, don’t ask for “best practices”. Furthermore, the words “best”, “easiest”, and “fastest” can have different meanings depending on the situation, so it can be difficult to know what your specific goal is. If your goal is actually just to achieve X in any way at all, see the above section about the question "How do I do X?".

In general, if your code already works, then Stack Overflow might not be a good place to ask a question about how to improve it. If you want feedback on some specific code you’ve already written, perhaps applying some best practices or optimizations that you’re not aware of, you should instead post that to Code Review and explain more specifically what you want to improve.

Questions that can be answered simply “yes” or “no”

Any question you ask that technically accepts a one word answer is almost certainly hiding other problems. Here is what we’ve observed:

  • Your question might actually have many followup questions depending on the answer, and you’ll be unsatisfied until all of them are addressed. Asking multiple questions in a single post is off topic for Stack Overflow, and prodding people in comments with new questions is likely to cause them to stop interacting with you. You should strive to ask a question that truly addresses the problem at hand.

  • Your question might actually be an X/Y problem, and the real problem isn’t being addressed at all. If you want to get the best possible help with your problem, take time to explain what your task is, show what you’ve done so far to achieve it in the form of a minimal, complete, reproducible example, and state what isn’t working the way you expect.

An example of a problematic yes/no question

Here’s an example of an X/Y problem that shows up as a yes/no question:

I’m trying to deploy code written in TypeScript to Cloud Functions. I’m using the TypeScript keyword satisfies, but it fails to deploy. Does Cloud Functions support TypeScript?

The problem with this question is that it makes an assumption about the source of the problem without actually explaining the details required to observe and reproduce the actual behavior. Instead, the question should instead show the code and configuration that doesn’t work, the instructions used to build and deploy it, and the error message that occurred as a result.

If all of the above was in place for the question, you would see an error message from the TypeScript compiler (before anything was deployed) that suggests it was unable to convert the code to JavaScript. The error message leads to the examination of the version of TypeScript installed in the project, which could be identified as lower than the required version that supports the satisfies keyword.

The other thing that would help the asker of the question is knowing that Cloud Functions just supports JavaScript, not TypeScript (TypeScript is first compiled to JavaScript before deployment). A good answer will explain all of this, including the step to upgrade TypeScript to the latest version.

You can see that the question “Does Cloud Functions support TypeScript?” wasn’t a very good question to ask at all. Technically speaking, the answer is “no” because Cloud Functions doesn’t support TypeScript it at all. But the real solution to the problem requires knowledge of the actual details.

Instead of asking a yes/no question, you should focus on illustrating exactly what you observe and explaining why it does not work the way you expect. Do not jump to conclusions about your observations - just state your observations and what you don’t understand about them.

Is it possible to do X?

This is a yes/no question and has all the same problems listed above. Instead of asking this, you should start by assuming that it’s possible to do what you want, then make an attempt at implementing it on your own. If you have problems, post your minimal, complete, reproducible example.

If you really do just want to know if some implementation is feasible, that sounds like a topic for general discussion and does not belong on Stack Overflow. Instead, post to a discussion forum.

Has anyone else seen this problem with X?

This is another problematic yes/no question, and is likely to be closed. If you are wondering if there is a disruption in some cloud service that others might also be experiencing, you should first check with the service provider - they often have a status page that shows known problems. Also check with any available customer support contacts. If that’s not available, you should instead post to a service like Twitter or Reddit for general discussion. Otherwise, if you want help solving the problem, you should focus your question on what specifically isn't working the way you expect, and show your minimal, complete, reproducible example.

Is it OK to do X? / Am I doing this correctly?

Whether or not some practice or strategy is “OK” depends heavily on opinions and circumstances. This is off topic for Stack Overflow, and the question will probably be [closed as seeking an opinion]. Instead, focus on what you’ve tried that isn’t working the way you expect. If your code is already working, then Stack Overflow is no longer going to be very helpful for you. Consider posting this type of question on a forum that allows for open-ended discussion that can be helpful for your concerns.

How do I improve this code?

Similar to above, this question is fundamentally opinion-based and there is never a single right answer, nor will everyone agree. General requests for feedback on code should be posted to Code Review instead of Stack Overflow.

Is it “safe”? Is it “secure”?

Security is an extremely complex issue, and is generally driven by specific requirements rather than some general assessment. You really can’t just “check the box” on application security and forget about it without first understanding your requirements. No one can tell you how secure your application code really is without first knowing how all of the data flows through your system, the accounts you have granted access to that data, and even the security of those individual accounts.

If you are concerned about security for your application, the only reasonable way to get thorough feedback on that is by hiring a professional to perform a security audit of your systems. The expert can then explain the risks at every point. Stack Overflow will not be able to do this for you.

Could you share some example code that does X?

Questions asking for sample code are seen as problematic and could be downvoted and closed. There are a few reasons:

  • It shows a lack of effort and clarity on the part of the person asking the question. The reader can’t tell if you actually made an attempt at solving the problem, and where you might be stuck with that.

  • Questions like this usually don’t specify what exactly what needs to be seen in a sample. Even if someone does share some code, it’s unlikely that you’ll get everything you need.

  • Questions asking for sample code are not much different in nature than asking for a tutorial, which is off-topic for Stack Overflow, and could get closed for that reason.

On Stack Overflow, it’s expected that you first make an attempt at solving the problem. Then, if your code doesn’t work, you can ask a question to understand what’s wrong with the code you’ve already written. Focus your question on the error message or unexpected behavior of a minimal, complete, reproducible example that you provide. This will help you get unstuck on that particular issue, and possibly reveal where your expectations are incorrect.

Bug reports

If you think the problem is not with your own code that you have control over, then don’t post to Stack Overflow at all. The community can only help if you’re making the assumption in your post that the problem is on your end, but you just can’t figure out what it is.

If your experimentation suggests that the problem is with some framework or library you’re using, and you have steps to reproduce the problem with reliable debugging information to back that up, you should try to file a bug with the product instead so that it gets noticed by the maintainers of that product. Most products use GitHub issues, a dedicated bug tracker, or some support staff for this. Stack Overflow isn’t a good place to report a bug or complain about others’ work because the post isn’t asking a programming question at all - it’s making an assertion about something outside of your control. There’s no reasonable way any member of the community can authoritatively address that.