How to ask questions with class

12 Sep 2019

The struggle behind programming

As programmers, we constantly face new obstacles daily. We can all admit that we’ve sought help from some source – whether it’d be a friend, colleague, or most likely an online forum – to solve that ‘bug’ that has been on your computer for ours. Especially in times of need, it can be very tempting to ask questions to others that you’ve never met in real life as if they are your friend. As Eric Raymond states in How to ask questions the smart way, there is more to a question than simply stating your problem.

Today, Stack Overflow is so popular that even high school students know that it is one of the best places to go to when you have a Computer Science question. Yet, there has been an increasing number of poor-quality questions due to the varying backgrounds of users asking questions. You may be asking, why is it so important for me to spend so much time on a question that will only help me for this one assignment? Raymond has the perfect answer to this question in his blog under the section “Don’t flag your question as ‘Urgent’, even if it is for you”. He says ‘that’s your problem, not ours’ and he is absolutely right.

Many times the helpful answers on Stack Overflow come from users who have experience, such as experts in the field. I’ve seen many instances where users have pasted their entire code from a project and learned that it does not yield the answer you may be expecting. Usually, a moderator or some other user will give you a warning or they may be nice enough to edit your question so that it follows the guidelines. However, most users will usually downvote what they consider a improper question, and it may not even reach the community.

Asking questions with class

You never know who is viewing your online activity. Your future employer could be observing your web footprint, and your online etiquette could play a significant role in your career. Ideally, we want to look like this guy below when we ask questions:

A smart question is respectful and usally beneficial to other users of the website including yourself. The smart questions are concise, and get straight to the point. As Stack Overflow states in their guide How do I ask a good question?, you want to “pretend you’re talking to a busy colleague and have to sum up your entire question in one sentence”. A good example is the question “What does ‘use strict’ do in JavaScript, and what is the reasoning behind it?” on Stack Overflow. First of all, the question is specific. Most people can make sense of the problem by just reading the question, and the user asks what they are looking for (“what is the reasoning behind it?”). When you click on the question, the user clearly points out the error they are getting from the program, and states how they have tried to solve the problem by googling the issue. This form of question writing is helpful to other users, and easy for the answerers to respond to.

An example of a less smart question is For-each over an array in JavaScript?. This question simply asks how a user can “loop through all entries in an array using JavaScript”. Then there is a code segment of what the user deemed as correct, with the question ended by “this seems to be incorrect”. How long does it take one to search ‘JavaScript loop through all entries’ on Google? There are plenty of sites out there, including W3Schools that provide you with lots of examples on a given function from JavaScript. This one resource alone could’ve answered this question. In addition, the problem is not stated clearly. It is unclear as to whether the user encountered an exception, or the function did not behave the way they expected, not to mention the uncertainty (“‘seems’ to be incorrect”), from the context of the question. This is not necessarily a bad question, just one that could’ve been more specific because there are many variations of for loops that accomplish the goal of this user.

The Takeaway

This experience has taught me how to construct my questions more carefully, and to proof-read my code before posting. Rather than going to Stack Overflow immediately, it’s usually a good idea to consult other sources first to make sure that the question hasn’t been answered already. As Dr. Johnson said in class, some errors are so obvious yet you may miss them at the moment since you’re panicking! If you’re asking for help on a question, then it’s in your best interest to make the life of the answerers as easy as possible since they are very busy people just like you!