How not to suck at asking coding questions

Alvaro Trigo Avatar

Follow on Twitter

Are you new at coding? Do you find yourself asking questions in places like stackoverflow or Github issues and they always get closed or down-voted? Nothing to worry about! I’m here to help you!! I’ll teach you how to pass that shameful phase and go into the next level!

I’ve been coding for a while and I’m the type of person who prefers to ask and get an answer in a matter of hours rather than spending days looking for the answer myself. (Yes, there are two types of programmers, but that’s a topic for another article).

An example of a good coding question

My relationship with questions

My score at Stackoverflow is currently 25.000+ and I’ve been asking more than 400 question and asnwering almost 1000 in that site alone. This, without counting questions I opened at multitude of Github projects or even issue trackers for projects like Safari or Chrome.

Additionally I’m myself the author of a popular Github project in which I answered more than 2700 questions and in which I encourage users to ask the proper way.

I encourage people to provide isolated reproductions

The fact that I had to answer thousands of questions, and still doing it on a daily basis, helped me to see the other side of the coin. The answer to why some questions get answered and why others do not. And what’s the best way to ask something to get a fast and accurate answer.

Do not tell me your life

Nobody wants to hear every single detail of your project when you ask technical questions. Do not tell them the whole story. Nobody cares about your “list of pictures for your cars’ gallery that gets overlapped with the phones’ gallery when scrolling through the contact form when clicking on your menu element that says ‘Meet us’ “.

A bad example of abstracting the use case. Not easy to follow.

Be more abstract. Go to the point. Ask for “why two divs get overlapped when scrolling certain amount”.

Isolate your scenario

This is key. An isolated issue gets far more answers and way faster. It makes it much easier for anyone to answer it and go to the point that matters.

Now, how do we isolate the problem? Basically abstracting it from your use case and reducing the amount of code to the bare minimum. Remove any code or markup that is not required for the reproduction of the problem. Try to avoid using external files / libraries, and remove anything from the code that is not directly related with the issue.

Replicating the issue is not the same as replicating your whole application/website. Replicate the problem, not the scenario.

Remember this: nobody wants to work for you for free. They just want to help you with a specific issue. Do not show them the whole code, they do not have time to read and make any sense out of that!

Provide a reproduction if possible

When talking about web developing it is quite easy to provide a reproduction of our issue by using codepen or jsfiddle. Other fields might not have it that easy, but they can always provide some extra elements to clarify the question, such as using pictures, videos, screen recordings etc.

Think this way: anything you can provide to clarify your issue and make it easier to be answered is always a plus.

Oh and please, do not link your website for it. As I said, nobody wants to work for you for free. If you provide a link to your website make sure it is only to a isolated reproduction instead of to the complete website / use case.

Keep it simple, stupid! (KISS rule)

Do not write the whole bible. Keep the question as small as possible. Provide only what is necessary.

Always review the question before submitting it. Can you shorten a sentence? Do it! Can you remove a paragraph that only provides extra unnecessary information? Do it! Can you reduce the amount of code you provide? Please do it!

The less you add, the easier it is to read and to understand, and therefore, to answer.

Provide versions

Information about which version and devices you are using can be of vital information for the quick resolution of the issue.

Things like:

  • What browser are you using? And which version?
  • Version of the software / library / framework ?
  • What device? Mobile? Desktop? Tablet?
  • What operative system?

Guide them with the steps

Does your issue requires a set of actions in order to be reproduced? Tell people about those steps in a clear way.
Do not just give them a link and tell them to see it. Explain them under which circumstances the issue takes place.

Something on these lines:

  • Access the URL on Internet Explorer
  • Click on the second item of the menu
  • Resize down the browser to less than 900px
Was this page helpful?