100 Days of Stack Overflow
As developers it doesn’t take long before you discover Stack Overflow. A quick search on Google for an error message usually has links to it in the top results.
Stack Overflow, for those that don’t know what it is, is a website that allows people to post questions on coding problems they are having. In fact, there exists the Stack Exchange, which is a network of 173 Q&A communities, including Stack Overflow. These communities range across a broad range of topics from photography to amateur radio. There is probably a community out there for everyone.
What makes Stack Overflow so special is that it gathers professionals, students and dabblers all in one place. Anyone can sign up and post or answer a question. This is obviously a double-edged sword as not all questions or answers are created equal. Each user on the website can earn “reputation” as questions and answers can be upvoted and downvoted by the other users of the site. So posting a well-written question or answer can lead to an increase in your reputation and a loss in reputation can occur by posting poorly thought out questions or answers.
Although I have used Stack Overflow for many years I haven’t really taken full advantage of it. I have been a lurker. I had searched for answers on Stack Overflow but I hadn’t posted my own question or answered anyone else’s. I thought that it was about time that should change. It all happened rather innocuously.
I had been working on integrating gray box end-to-end testing into an app that I was building when I stumbled upon a question that I could answer. So I took the plunge, researched the topic a little further, and then answered the question. Although my answer wasn’t marked as the “accepted” answer, no other answers were given. I thought that I should try and answer another question or two. I did and was rewarded by having my answer accepted and upvoted (several times). I was hooked… well, not quite!
Due to work commitments and life just getting in the way, I didn’t really answer any questions for a few months. My reputation sat at around 100 from the questions that I had answered. However, I decided to turn that around and actively give back to the community. So here is what I have learned from answering 200+ questions and completing 100 days of trying to answer at least one question a day.
Not all questions deserve an answer!
Some of the worst questions that I have seen take the following format:
I get this error. <Error pasted in an unformatted state>
These types of questions aren’t going to illicit a great response from the community. It takes time to write a good question. To make sure that you have given enough information to would-be question responders is not an easy task. I could write for hours on how not to write your question, but here are a few tips for writing better questions:
- First, search and see if you can find a question that is similar to yours. If you find one, then only post another if the answer provided doesn’t fully help you. It is also a good idea to include a link to that original question detailing why yours is different and explain why the answer provided doesn’t answer your query.
- Make sure your title is related to your question. Good titles mean that more people will look at your question. More people looking, means more people answering.
- Include the minimum amount of code that is required to replicate the problem that you are having. Links to off-site places like GitHub repos or snacks on Expo are not a good idea as those links could expire, making your question have less meaning in the future.
- Copy and paste your code/error into the question. Do not post images of your code/error. It makes it hard for those trying to help you. They may want to try out your code but cannot do so easily.
- Make sure what you are pasting into your question is formatted nicely. The question box has editing tools that can allow you to format your code. Code that is easy to read is easier to answer.
- List what you have tried. Don’t assume that the possible question answerer has thought of everything you have. Detail it, so that people don’t waste their time writing up an answer when you have already discounted that.
For more information about creating a Minimal, Complete and Verifiable example check out this post in Stack Overflow’s help center.
Not all answers should be written!
From what I have seen many people rush to post an answer in the hope of getting a boost to their reputation. They will post a small snippet of code saying:
Try this. <Line(s) of code with no explanation>
Although this snippet may actually be the answer, it doesn’t help the question poster to improve. If the question poster has taken the time to write a well thought-out question (and even if they haven’t) you should provide a good answer rather than perpetuating the cycle of bad answers. There are posts that just contain a link to another website. Links can expire and they don’t really help the question poster solve their issue.
So here are some tips for writing a good answer.
- Don’t just write a code snippet without any explanation. Make sure you explain why this is the correct solution and why it should be done this way. This helps other users who have similar problems – if your answer has an explanation you will probably get more rep for it.
- If you are using a link, make sure you summarise the gist of it. Don’t just post the link. As mentioned above, links expire never to be seen again and the value of your answer disappears with the link.
- Make sure your answer is well researched. SDKs and code bases update frequently. Make sure that if you are referencing a particular code base that you state the versions that your answer works on.
- Write your answers in such a way that they are accessible to all. There is nothing wrong with ELI5 (Explain like I’m 5) but don’t dumb it too much as you don’t want to sound patronising.
For more information about writing a good answer check out Stack Overflow’s guide in their help center.
Should you post on Stack Overflow?
Yes, you absolutely should! Stack Overflow is a great place to find answers to questions that you didn’t think that you could get an answer to. It can be intimidating writing a question or even answering one. The best advice I can give is take your time, follow the steps above, and read lots of questions and answers before starting out.