Asking the Real Questions

07 Sep 2018

For the Software Engineering course I’m currently in, we have been asked to examine some good and bad questions from the Stack Overflow forum per the standards described by Eric Steven Raymond. I’ve found a couple of examples that I think exemplify what makes a question good and the ways that you should go about asking for help.

Let’s start with the worse of the two questions that I managed to dig up. This question – question provided below – is asked by a user who wishes to understand the concept behind a stack overflow within the C programming language submitting a snippet of code and a small paragraph containing their questions and concerns.

After run this program compiler will print “Stack Overflow” until stack overflow.Here I know stack overflow means, that means it will print until memory full.Here my question is which memory is it? What is the size of stack that is overflowing?

Raymond considers a poorly asked question one that isn’t thought provoking or one that demonstrate a lack of effort, potentially in the way the question is phrased, or even one that is purely just too simplistic that could probably have been found from a well worded search. The reason for why I thought this to be a poor example of question asking is that the question asked and its encompassing concerns disguise the user’s lack of effort in finding the answer for himself and their lack of initiative in learning. It might not have entirely been the user’s intent to come off as uncaring but simply providing information such as his method of learning or attempts to have done so would have reflected enough of his integrity to warrant a good or varied amount of responses. To add to that, the question has also been labeled as [duplicate] doubling down on the user’s obvious lack of effort.

The “good question” that I found happens to be one of the most popular posts on the site –question provided below– involving a particularly curious user on finding the most efficient way to sorting his socks. This question does many things right but is also great since the approach was lightly comical while also concisely conveying the question at hand.

Yesterday I was pairing the socks from the clean laundry and figured out the way I was doing it is not very efficient. I was doing a naive search — picking one sock and “iterating” the pile in order to find its pair. This requires iterating over n/2 * n/4 = n2/8 socks on average.

As a computer scientist I was thinking what I could do? Sorting (according to size/color/…) of course came to mind to achieve an O(NlogN) solution.

Hashing or other not-in-place solutions are not an option, because I am not able to duplicate my socks (though it could be nice if I could).

So, the question is basically:

Given a pile of n pairs of socks, containing 2n elements (assume each sock has exactly one matching pair), what is the best way to pair them up efficiently with up to logarithmic extra space? (I believe I can remember that amount of info if needed.)

I will appreciate an answer that addresses the following aspects:

A general theoretical solution for a huge number of socks. The actual number of socks is not that large, I don’t believe my spouse and I have more than 30 pairs. (And it is fairly easy to distinguish between my socks and hers; can this be used as well?) Is it equivalent to the element distinctness problem?

Right from the go it can be noted that the original question generated dozens upon dozens of responses which is fantastic for many reasons. More practically speaking the user probably received more ideas that he could have possibly sorted through giving him many options and tests to try out. The same works the other way around as well since anyone viewing the post (past, present, or future) with the same or derived question has access to the same wealth of information. This satisfies exactly what Raymond expects in a good question as the user opened up with his own initial findings, a clear problem, additional potential solutions, and an open end to the question. The post became more than just a Q&A session, it became an invitiation to all and was overall just a fun question to put out.

To sum this all up, it’s easy to see how learning how to phrase yourself and ask questions on the net results to both personal and global benefit. An unclear, poorly worded question leads to a dead end really quickly and becomes less inviting for people to stick around answer since it isn’t worth it in the end. On the other hand, a good question gets around much quicker and contributes to everyone’s life in unexpected ways. Some might get more information than what they bargained for and that’s not a bad thing at all! Some bigger posts snowball to the point or become relevant enough to show up on search engine results and becomes useful for many times t come. Whatever it is, take it as a lesson to take question asking seriously! It goes a long way for everyone.