StackOverflow 101

12 Sep 2024

Stack overflow is a platform where developers can ask questions related to programming. I often found myself having at least one tab of stack overflow open when doing my homework, if I did not understand what was going on in my class. For example, one of my projects required me to code in python, since I was using sk-learn. I remember having many tabs of stack overflow open about the machine learning algorithm I was using, just so I could figure out how to properly implement it, and how to quickly get certain values I wanted. The questions that I had were often already answered on stack overflow, however sometimes you have a question that hasn’t been asked on stack overflow yet. Then you would want to ask your question in a way that allows you to properly get an answer.

Smart Way

The smart way to ask a question is to follow the guide by Eric Raymond. Here’s an example that I found on stack overflow: Smart style question

The poster of the question asked if there was a way to reduce the amount of memory his app is using. This question was asked in a smart way because the heading of the post clearly states what the user needs help on. The user also describes the problem precisely and informatively by using facts and screenshots of what he is seeing. This is a smart way to ask a question because it allows someone that may have the solution to the problem to make their own judgment and not be thrown off by the poster’s own suggestions. The post also details what they did before making the post, which includes the library that they use and why they are using it, if it’s a problem with just their library or is a problem for all libraries, solutions they tried, how to replicate their problem and part of their code. These are all important to have so that an answerer does not have to try possible solutions that the poster knows doesn’t work and so that they can replicate the problem so that they can try to fix it. The question asked should be one that can NOT be answered by looking at the documentation of the code.

Not So Smart Way

The not so smart way to ask a question is to NOT follow the guide above or at least a part of it. Here’s an example of one that I found on stack overflow: Not so smart style question

The original poster for this question asked how to find the index of an element in a list using python. While this question is quite simple and there is no shame in asking simple questions, the answer was something that could have been found by reading the documentation for lists in python, and thus a bad question. Thankfully, the replier for this message was quite nice, and did not shame the poster, and even explained the caveats of using the method they provided which was using the .index() function.

Conclusion

Using a smart or not so smart way to ask a question may not necessarily mean that your question will or will not be answered, but it can help. I believe that for programmers specifically, if we have a question we need to ask it in a smart way as it allows us to get the most help out of the question. If we ask a question NOT following the guide, we risk our questions being unanswered, and that if we do get an answer then it isn’t a good answer.

After reading the guide, I realize that when I eventually do find a question that isn’t already solved, then I need to just present the facts that I have and not what I think is the answer. If I write what I think the answer is in my question, then I should just try to use my suggestion to solve the problem instead of asking for help. Additionally, my suggestion on what the problem is, may cause people to approach the question my way, which could not work since the approach I’m taking is wrong. Writing my questions in a smart way also allows people that may have the same question in the future to find my post easier because of the way that it is setup.