Good Questions Require Effort

25 Jan 2024

I played chess competitively for over a decade while I was in school. One thing that has stayed with me from this experience is something my coach would often say. He would set up a chess position and ask the students what we should do in the game. When somebody would shout out a move, he would say something quite simple, “Don’t give me a move, give me a plan.” This is something I reflect upon because of the great lesson he was trying to teach. A solution is not as good as learning and planning the proper path to a solution. I believe that this concept is very relevant to computer programming. In fact, if a programmer doesn’t follow this concept, they may just embarrass themselves in a public forum (which is the least of their problems).

Eric S. Raymond, a prominent software engineer and writer, once wrote an article on how to write a smart question for programming forums. The ESR’s qualities of a smart question can be boiled down to a few key ideas: the question is clear, it has a good title, it has ample explanation, it has an adequate (yet not too long) block of code, it is polite, and very importantly it shows evidence of work put in before the question was asked (among other qualities). When a person provides a quality question in this manner, others can take it seriously and help the person learn how to solve the coding problem they face. When uploading a question to Stack Overflow or other similar forums, a programmer should follow Raymond’s guidelines as they will increase their chances of getting a good answer rather than no answers or ridicule.

When someone posts an unclear or vague question, few people will want to help. Additionally, hackers and other experienced programmers are immediately going to be wary of any impolite or angry questioners. For example, a post on Stack Overflow entitled “Condition in Javascript doesn’t work” (already a red flag), didn’t get great responses due to its unpleasant tone and lack of work put in by the questioner. The question starts with the line, “I’m about to get mad because of those conditions in JavaScript. Why this one doesn’t work?” The post continues, with the questioner showing the code of his conditional and stating that he has done conditionals before in a bunch of languages but Javascript doesn’t seem to be working. This post breaks so many of ESR’s question rules. It has an unclear name, negative tone, and an arrogant suggestion that the language is wrong, not the coder.

As is expected the responses to this question were sparse and not great. Additionally, the others in this post often took subtle jabs at the questioner. For example one response pointed out that part of the coder’s conditional statement was just bad code saying that segment “will always be true regardless of the value of act. No, that’s not a Javascript annoyance, it’s basic logic.” When looking at the answers it seems like many of those who chose to respond at all, did it to show why the questioner was wrong in his assumptions more than to really help him out. To top it off, his comment was also downvoted to a score of -4 votes. This example shows that bad questions are not helping a coder or his reputability on Stack Overflow. There may have been an answer in this specific instance, but it wasn’t really a collaborative or constructive experience

On the flip side to this example, there are many great questions on Stack Overflow that elicit much better responses. When clear and comprehensive questions are posted, they generally receive quantitative and qualitative feedback. A great example of this is the post titled, “AngularJS : Initialize service with asynchronous data.” This post is a breath of fresh air compared to the last question. In the post, the writer explains the problem they face regarding the AngularJS asynchronous data, they provide a manageable chunk of code, describe their desired functionality, and explain the error the code would throw. They also provide multiple potential solutions that they had worked on and code to accompany them, but explained why these implementations were not satisfactory to their functional needs (such as one using a global variable). As defined by Raymond, this is a superb question. It is clear, breaking down the goal of the program. It further clarifies and shows evidence of effort by providing the potential but inadequate solutions.

The responses to this question are incredibly different from those in the first example. Firstly, there are a lot of people chipping in, providing suggestions and working together toward a solution. Since the questioner clearly spent a lot of time on the problem and still needed help, people in turn took the time to write their own code and provide it. One respondent even provided a plnkr link to work on coding a solution with the original person who asked the question. In the end, both the question and the prominent solution have hundreds of upvotes while the post has over 200k views. All of this shows how constructive a good question can be on Stack Overflow. It can spur collaboration and advanced problem solving.

Ultimately, the way a question is framed can drastically change its reception. Lazy questions can lose a person credibility and provide a slight chance of help. Clear, polite, and effort-based questions provide a chance for collaboration and intuitive solutions. When it comes to programming it’s best to take ESR’s advice and put in a little extra effort before hitting the post button. This may help you earn something even better than a solution, an opportunity to learn with others how to achieve the solution.