Introduction
When you first start developing, if just for learning or commercial purposes, you're sooner or later going to have to post a question on stackoverflow. One thing I had to learn the hard way is, that when asking a question there, you should be very cautious of how your question is written and what you will have to write. This is not only relevant for posing questions but also for answering them.
My motivation
I personally believe that this is such an important topic, especially for beginners, because stackoverflow enforces that: Posing too many bad questions or answers can get you banned!
They do that for a good reason though. With an enforced quality control, the website keeps its reputation, seriousness and the most importantly: it becomes sustainable over long periods of time. I mean how often did you search for an answer and got it from a 7 year old stackoverflow question? Being able to get the wanted information so many years later is such an important part of our developer-world today.
Before writing the question
There are a few things you need to think about even before writing your question, as to really know if and what you need to write
Conducting proper research
Step one is always conducting research. When you have a problem, you should first search the web, try out some solutions, think about the problem yourself and check if you have a logical error somewhere. Most of the time you will realise that you don't even need to ask the question because it was either a logical error or already answered somewhere else. You have no idea how often I see stackoverflow questions that are marked as duplicates. Posting a duplicate will result in downvotes and not your question answered.
Choosing the correct tags
Now you really searched through the entire internet and couldn't find anything useful so you decide to post your question. Before you begin writing you should also think of what tags are appropriate. Not putting any tags will most likely result in your question not getting enough readers and with that also no answers. Putting unfitting tags will result in your readers having no knowledge of the issue and being unable to answer. That's why I think it is very important to know what people you are looking for before you write your question
Writing your question
Now you know that your question is sensible and you also figured out what tags to give it. Great! Step one is done. Now you get to writing your question. There we also need to pay attention to a few details
Picking a good title
You need to start off writing by picking a good title for your question. It needs to be informative but also interesting. A very bad example is this:
When you read 'I have some problems with my python code' you have no idea what it's about. Most of the time when you can't pick a good title, you haven't researched and understood your problem well enough yet.
Writing the actual question
After you have a catchy and informative title you start writing your actual question.
The most important thing you have to pay attention to is that your question should be as short as possible, while still containing all the information it should. People answering your question already do unpaid work, so they don't want to read unnecessarily long texts.
Code snippets
Almost as important is giving enough code snippets in your question. If, for example, you ask about some weird exception your code is throwing, it's very important to show what code throws the exception and what the exception itself says.
Every question you ask, you should try to abstract. An example for that is when you have a problem with the devise gem in rails. When you get an exception, there will most likely be the objects disc location written like this:
#<User:0x4f63e01>
. Now instead of writing the entire memory location into your question you should maybe only include the #<User>
part and exclude the rest, so the next person can find it more easily when searching the problem on the internet.
After you're done writing your question you should just proof read it. That will help you eliminate typos and grammatical errors, which aren't the biggest problem. What the main purpose of proof-reading your text is that you can check for missing or useless information.
After publishing your question
With publishing your question, you're obviously still not done. There are a few things you have to look out for.
Answering to comments and solutions
The stackoverflow community is very active, so for most questions it doesn't take long go get answers and comments. For you, the publisher of that question, it's important to respond to the input that you get.
Give props where props are due
If someone takes his time to answer your question, you should at least comment on it. If it's a good answer, which doesn't exactly solve your case, it may still deserve an upvote.
Now in the case that someone gives you the correct answer, you should definitely mark it as the correct solution, partly for the guy that gave you the solution but mostly because the next person with the same problem can quickly see which answer worked for exactly your use case.
And the most important part
The most important part is, that everything I said is as I see it. All of it was opinionated and not an objective fact. That's why it's important, especially for new developers, to collect experiences themselves and learn by doing instead of just reading tutorials all day long.
Happy Hacking :)
Top comments (2)
Ideally, and this is the reason for the "duplicates" close reason, something being closed as a duplicate means that there is an answer.
That's not to say people aren't overzealous with closing as duplicate, but I would hope that most of the time it actually works.
True. What I meant was that your post most likely won't get any answers, because the answer is somewhere else already.