How to get answers on StackOverflow
6 min read
Talking about Questions And Answers in software development is talking about stackoverflow.com (SO from now on). There's a bad experience shared among many beginners and that's a shame. Instead of taking a gatekeeping attitude, my intention here is to explain several common errors and misconceptions that lead to this bad experience in SO and how to avoid them to get the most out of that great community.
Cover foto from pexels.com
First of all: read the community guidelines
If you're an experienced user and have read/heard any rant about stack overflow you'll instantly notice that most of the problems people have could be solved if they just read the guidelines.
There is a badge in SO that you get only by reading the tour page:
So when I'm answering questions, this is a red flag for me:
This user hasn't got a single badge, which means they haven't even made the effort to read the tour page. Unless the title of the question suggests that it really is interesting, the most probable thing is that the question doesn't comply with the community guidelines. Most people don't want to spend their time on these kinds of questions.
Go and get the badge! Read: Tour - Stack Overflow
And also one of the most linked pages in the comments of unanswered questions: How do I ask a good question? - Help Center - Stack Overflow
Actually, a part of what I say here is also written there. This is my attempt to bring this to those in DEV that might have not heard of it.
Make sure that your question belongs in SO
SO is a place for asking programming questions. Do you have a problem with your code? Go to SO. But code is a very particular topic. There are many others questions related to software that don't belong there, so if you post one, people will want you to remove it.
There are other Stack Exchange sites that you can use, where your question might be better received; take a look at the list of stack exchange sites to see which is the best place to ask: All Sites - Stack Exchange
Do your own research first
Nobody wants to answer the same question over and over again for each new user. Before posting your question, look up if someone has had your problem before. It will surprise you how hard it is to ask an original question.
If the answer to your question is one search away, then don't post it. It's very bad taste to make others google your problems for you.
If someone marks your question as a duplicate
There are two possible cases:
Your question is actually a duplicate: then don't take it personally. The site wants to remain as clean as possible and duplicate questions are just noise. Remove the question and upvote the existing one.
Your question is not a duplicate of the proposed question: then kindly explain why the other question is not useful for you, what are the differences in your case and what information you lack.
Stack Overflow is not a coding service
No one charges money for answering questions. But there you have people with full-time jobs, people with years of experience and people just like you, trying to gain some experience. We are all trying to help each other and learn, so if you copy-paste the statement of your latest assignment and expect someone to post the solution for you, people will find it disrespectful.
It is not bad to ask questions about your homework, but make sure you have tried to understand what they require you to do, conduct your own research first and make a question when you have specific aspects that you need help with; those would make a valid question.
More on this topic here: How do I ask and answer homework questions? - Meta Stack Overflow
Do some debugging, reduce the scope
A lot of questions contain just a wall of code with the caption: "What's wrong?". These kinds of questions usually ask you to do an effort that the person asking could perfectly do: debug.
This is a crucial step that you can take before posting that will make it easier for people to answer and help you:
- Try to find what part of the code produces the error. Post only the code relevant to the problem. Understanding other people's code is always hard, so reduce the effort required all you can.
This is not easy to do with every technology but it is possible in most cases.
However, avoiding walls of code doesn't mean asking without giving any details. It is much more difficult for anyone to help you without any readable and reproducible source.
More on this here: How to create a Minimal, Reproducible Example - Help Center - Stack Overflow.
Use the correct tags
Read the description of the tags before asking and try to use the ones you need. The correct tags will give your question visibility but will make sense in the context of the question. A common example: using C and C++ tags in a C++ only question.
Don't assume an offense
If they suggest or ask something in the comments of your question, don't be rude. I've seen new users answering comments with a horrible entitled attitude and I immediately lose the will to help them. Remember you are asking for help, not demanding results.
If you ignore the community guidelines, a lot of people will do the same with your question.
If the question belongs to another community, they will tell you to remove it.
The ideal question looks like this:
I'm trying to do A My approach is this one: (show relevant code, maybe cite your sources). But I have B problem, so I've tried C and D but it doesn't seem to work.
Even with these steps, there will always be people that don't behave well or will not understand the requirements of your problem, but this will happen in every self-moderated online community. However, in a knowledge-driven community like SO, that will be at least less likely to happen if you try to take this advice.
My last tip: browse the feed of new questions for one week or two. If you only use Stack Overflow for reading answered questions and eventually asking yours, you might think that the community is very strict and closed. But when you receive day after day all those questions, you will start to see patterns and see how many users don't know how to properly ask for help, how many ask you something that is a DuckDuckGo/Google search away and that haven't even tried anything before asking. I know you can do better.
I hope this helps in some way to bring beginners closer to this community, without which software development would be completely different from what we know, and ease the experience of everyone involved. If you have any other tips or comments in this respect, I'll be happy to read them!