The Best and Worst Ways to Use Stack Overflow
Stack Overflow is an incredible collection of programming and software knowledge. Thousands of students and developers use it daily to lookup answers for questions they can’t solve easily themselves. Stack Overflow taught me so much over the years, I have used it since I began to learn to program. It’s built and grown by a community of developers, with new questions and answers being added all the time.
However, contributing to Stack Overflow, asking questions and answering them, is vastly different from just searching and reading information on the site. Stack Overflow has a very steep learning curve, for a long time, it wasn’t really welcoming toward beginners. If you are interested in using it to grow and further your skills or reputation as a developer, this article is for you. On a site like Stack Overflow, there is no right or wrong, all content will eventually be moderated by the community. Yet, you will want to avoid situations where despite good intentions, you get downvoted to oblivion.
The Purpose
When people start using Stack Overflow, they often don’t fully understand the purpose of the site. Stack Overflow is not a discussion site or a forum. It’s a knowledge base. That means for whatever questions are asked, any answer should be accurate, specific, and useful to the highest degree. It’s not a place to post partial answers or to ask questions on questions. Answers are upvoted and downvoted to determine the communities opinion on them. There’s one, critically, crucially important detail to understand about upvotes and downvotes: Roughly 80% of all votes on Stack Overflow are downvotes.
In fact, there’s even some users with hundreds of thousands in points that have an up to down vote ratio of over one to one thousand. That means for every one up vote they gave, they also gave over a thousand down votes. This isn’t meant to scare you, it’s to help you understand Stack Overflow does have a high standard of quality for content. Even the best answers also get their share of down votes. Any answer you give should have careful thought and effort put into it.
Being a knowledge oriented site can also imply there’s no room for subjectivity. To an extent that’s true, but it’s more complicated than that. Whether or not something is considered subjective depends on how much information exists on that particular problem, or if there is a widely accepted solution. For example, a question asking “How to add more items to a list in Python?” could only be reasonably answered by suggesting to use the append or insert methods of a Python list. An answer giving a solution by construction an entirely new list, would likely be heavily downvoted. That’s because a list in Python is designed for mutability, answers diverting from that use will simply not be useful or welcomed.
Asking “How to ensure a particular module is only imported from a certain directory?” is a question that’s more open to interpretation and does not have a widely accepted methodology. A simple answer to such a question would be to suggest inserting the directory path at the beginning of sys.path
. Although that answer works, it’s still not full proof. The Python interpreter actually checks sys.modules
before it checks sys.path
. There’s also a completely different way to achieve the same desired behavior, to run Python in a virtual environment, avoiding conflicts between module names altogether. The point is, there’s multiple ways to answer such a question, given any answer accurately argues for itself.
Next, look at both the best, and worst ways you can use Stack Overflow to grow and improve as a developer.
Worst
As mentioned previously, there’s no wrong way to use Stack Overflow. Yet, there are many pitfalls and traps you can avoid to prevent being heavily downvoted. These are those patterns of contribution you will want to avoid.
Asking simple questions
Most simple questions are likely to be closed as duplicates on Stack Overflow. This happens to questions that are usually have a solution found easily in a language’s or package’s documentation. While this won’t subtract points from your total score on the site, it’s just a waste of time since you won’t get your question upvoted. Both questions and answers can be voted on, up votes in either case increase points, while down votes decrease them. Try to search if you question exists before you ask it.
Keep in mind, sometimes questions are mistakenly marked as duplicates. This can be because you weren’t clear enough on the specific answer or knowledge you sought. Good news, Stack Overflow allows you to edit a question and reopen it if this happens, netting you more points if that edit is better received.
Giving answers that don’t match the question
This might sound obvious, whatever answer you contribute should be suited for the question being asked. Stack Overflow enforces a rather strict interpretation of this rule, though. Submitting an answer which suggests a solution that either doesn’t fully resolve the problem, or uses a different tool or method than what’s specified, is highly frowned upon, and will result in downvoting. This is probably the absolute worst way to use Stack Overflow.
An example can be as follows. There is a question, “How to get the stderr from a process with Popen?”. You answer, “This can be accomplished using subprocess.run and accessing the stderr attribute of the return value”. This answer would be considered inappropriate for the question, because it’s specifying the use of a different builtin object the question is not asking about. Stack Overflow is not a discussion forum, and such answers are not useful or desirable on that particular question.
Answering questions with highly popular tags
Questions on Stack Overflow are organized by tags relating to the specific topic of software development they are concerned with. The site holds tens of thousands of tags, encompassing every topic you can think of. The most popular of which are general programming language tags, such as [javascript]
or [python]
. The most popular tags have hundreds of thousands, if not millions of questions listed under them. While you may see a lot of questions that feel easy to answer, there are some substantial risks.
Remember the user I mentioned that gives over a thousand downvotes per one up vote? Users similar to that are likely top contributors and lurking in popular tags. Answers you give to questions under these tags will be under high scrutiny. Additionally, many questions in such tags get answered very quickly, as many people are also looking at them. By the time you write a well thought out answer, some top contributor may have already answered it before you. Or, your answer or code may miss small details involved in answering the question, leading to a higher degree of downvotes. Generic, language syntax type of questions are frequently marked as duplicates, so you may start putting effort toward an answer for nothing.
Best
These strategies and tips are meant to help you achieve the most up votes with the least down votes.
Answering questions in less popular tags
In less popular tags, such as [csv]
or [bson]
, questions stay unanswered for much longer periods of time. Such tags also have far less super contributors (reputation > 100k) you have to compete with. There’s also less intensive, harsh moderation going on. I am by no means suggesting that moderation is bad or counterproductive. On the contrary, it’s what builds Stack Overflow as a community. However, not all moderation is conducive to increases in quality.
I wrote this answer to a question I had asked which to my surprise, no one answered. I explained the solution and all the needed steps for others to implement it if they found themselves in a similar situation. Yet, my answer was still downvoted, due to using a different, yet equivalent keyword argument in the setup function for a Python package. There’s no difference in behavior between the two argument fields, but was still marked down by the community. If I were to write that question again, I wouldn’t include the [python]
tag.
Asking questions with no obvious solution
The best questions to ask, and the ones that will get the most upvotes, are the ones with no obvious solution. This doesn’t mean super complex questions almost no one can answer or solve. Questions that concern a common situation, but that have no easily identifiable or straight forward solution, are the ones you need to be asking.
I have question that I asked five years ago that has since gotten over 50,000 views. The question asks how to match a particular string against many different possible strings using regular expressions. Generally, checking if a string is present in a group of strings can be accomplished with a hash set. But in the case of regex, there is no widely used method. One option, which turned out as the best answer, is using a list of words joined with the|
“or” operator in regex. Another option, the second answer listed, is using named lists from a common third party library for regular expressions. Both answers work fine, but the former doesn’t depend on any other packages, it uses native Python.
The lesson here is asking questions with no direct or straight forward answers are more likely to be upvoted, and more likely to generate answers.
Conclusion
Overall, Stack Overflow is an immense body of knowledge that’s built by a vast community of developers. Using it is easy, contributing to it isn’t that easy. However, if you put careful thought into your answers, stick to less popular tags, and try to ask more complex questions, you will gain a lot more out the experience.