Have you ever asked a question and received zero response?
I have done a lot of coding-related research, which brings me to Stack Overflow very often. After a while, I started to notice a lot questions that aren’t answered or are even locked because it is not specific enough or does not follow the question guidelines.
Asking a good question doesn’t strike me as being that hard, but it seems like bad questions pop up quite often.
Here are some tips on how to write a good question. This article is specific to coding-related questions, but can also be applied to any type of questions.
Before you post your question, do your own research. Take a look at other people’s questions that are similar to yours. Chances are, there are other people before you that ran across the same problem and received the necessary answers. When you do post your question, cite related questions, even if it does not answer your question. This helps others identify how your question is different.
Be specific with your title. Describe what your problem is in one line. Ask in the form of a question if possible (and it often is possible). People are busy and respond to questions out of their good will. When looking at postings, they will see a long list of questions. If your title is generic, it will not stand out and will get overlooked. Specific questions that state exactly what the problem is will stand out and catch their attention. Also, use tags to label your questions.
Explain your question. It should include all of these pieces:
- What you are trying to accomplish. What should your code do?
- What is happening? What is it doing instead?
- What you have already tried. What came up in your research? This shows others that you’ve put in time and effort into trying to resolve the problem yourself and are not just leeching for information, which will make them more willing to help you.
- What your environment is like. Be as informative as possible (language, platform, operating system, or anything that is relevant).
- Steps to reproduce your problem. Include the specific part of the code that is causing the problem or not doing what you want it to do. Only include enough code for them to reproduce the problem. Anything else is irrelevant. Big pieces of code will make people not want to look at it.
- Also include what you are trying to achieve in the grand scheme of things. Others may have insight on how to better accomplish what you’re trying to do in an easier and more efficient way, which may even render your problem or question irrelevant.
Make sure that your post has correct spelling, grammar, and punctuations. It doesn’t have to be perfect, but it should sound like you are educated. Format your question so that it is easy to read. Break it down into paragraphs if it is long and section off your code. Reread or have a friend read over your post and see if it makes sense to someone with no prior knowledge on what you are doing. Last, but certainly not least, make sure you actually state the question in your post. A lot of posts I see online are just long explanations or statements of what they’re doing with no real questions to be answered.
Monitor your question and respond to feedback. Be opened to it. Provide clarification or more information when something is unclear to others. Do not take responses personally. Most people that respond to your questions are there to help.
That’s All, Folks
Hopefully, these tips will assist those in need write better questions that will generate good answers.
Do you have other tips on how to write good questions? Let me know!
This blog has been initially published on tonymai.github.io.