How to ask a question in computer science.

 

How to ask a question in computer science...

Here are some tips on asking questions in computer science.  Specifically, these are tips for asking me (the professor) for help.  Many of these tips can be used in industry as well.

Let's start out by looking at some examples of some poorly asked questions.

  • "My program crashes when I type in negative numbers."
    • Reason this is bad:  No question was asked.
    • You need to ASK A QUESTION instead of fishing for information and hints.
  • ‚Äč"It is printing backwards.  What is wrong with my program?"
    • Reasons this is bad:
      • The question is way too vague of a question with no background information given.
      • The question is way too abstracted with no detail. It is like calling a mechanic on the phone and asking why your car does not start when you turn the key.  There can be many reasons (battery, starter, fuses, relays, timing belt, fuel pump, fuel filter, no gas, no engine in the car, etc.).  Now the mechanic has to walk through a bunch of possibilities and does detective work and will probably ask you a bunch more questions to start the investigation:  ( Does it have gas, Does the motor make a noise, Is there any fluid under the car?)   

 

  • Computer science is about solving problems and critical thinking.  These are are essential skills in the industry.  You need to dig deep into your code and figure out what is happening.  You need to learn to ask the right questions to yourself.   You need to isolate the problem and figure out specifically where the problem resides.
  • A mechanic has to repair a car that someone else designed and built.   Often in computer science, YOU are the author of the code and you are the one that ultimately needs to solve the problems.

 

How to ask a good question:

  1. Present the background to the problem. 
  2. Present what you have tried and how you debugged it.
  3. Present specific issues.   
    1. This means that you need to dig in deep into your code and trace it. 
    2. Use debuggers and step through your code line by line while it runs.
    3. Debugging should not be comprised of only examining program output.
    4. You need to talk about variables, functions, data, states, etc.  The output is only the symptom of the real issue.
  4. Perhaps show a small snippet of code (not the entire program)
    1. Explain what you expect to happen
    2. Explain what actually is happening. 
    3. Show your thought process in how you debugged it so far.
  5. Finally, ask a question
    1. Your question should be presented in a clear way where the reader does not have to read your mind.
    2. You should be asking questions about specific technical aspects.

Realize that in industry, your colleagues will be busy and you cannot over burden them with detective work that you should have done.  

Stackoverflow also gives guidelines for asking good questions.