How to ask for help

From Computer Science Wiki
Jump to: navigation, search

Having problems is normal. If you do not learn how to solve your own problems, life will be difficult for you.

Step One: Why can't you write this program?

When you first realize you have a problem, follow these steps:

With gratitude to and permission from Stephen Hughes (Coe College) and Philip East (University of Northern Iowa)[1]
Type of problem What you need to do to solve it
I don't understand the problem #Requirements Gathering
I can’t describeGive a detailed account or picture of a situation, event, pattern or process. how to get a solution #Algorithmic thinking; problem decomposition
I don’t know all the details #Real world problems require research
I can solve it by hand, but I don’t know how to code it. #New Language Features
My code isn't working the way it should #Debug your code

Requirements Gathering

Do you understand EVERY. SINGLE. WORD. in the problem? In this case the student needs to: re-examineConsider an argument or concept in a way that uncovers the assumptions and interrelationships of the issue. the problem statement identifying specific problem requirements; play with the problem—drawRepresent by means of a labelled, accurate diagram or graph, using a pencil. A ruler (straight edge) should be used for straight lines. Diagrams should be drawn to scale. Graphs should have points correctly plotted (if appropriate) and joined in a straight line or smooth curve. pictures of interaction, imagine inputs & outputs, ...; seek clarification from the originator of the problem, etc.[2]

Algorithmic thinking; problem decompositionSeparate into simpler constituents.

If you don't know how to get to a solution, break the problem down into smaller parts.

A common obstacle novice programmers face arises from difficulty with problem representation—making the problem more concrete in their minds. They are not familiar with thinking abstractly in terms of variables and operations on them. The action in this case is to specify the desired outcome and begin problem decompositionSeparate into simpler constituents. from that point. Produce questions that indicate intermediate outcomes desired or information needed. IdentifyProvide an answer from a number of possibilities. Recognize and state briefly a distinguishing fact or feature. data needed to produce the outcomes and where that data must come from; necessary manipulations of the data; tasks that may need to be repeated or occur depending on some aspect of the problem data; etc.[3]

  • Create a diagram of the problem
  • DrawRepresent by means of a labelled, accurate diagram or graph, using a pencil. A ruler (straight edge) should be used for straight lines. Diagrams should be drawn to scale. Graphs should have points correctly plotted (if appropriate) and joined in a straight line or smooth curve. a picture of the problem
  • ExplainGive a detailed account including reasons or causes. the problem to a rubber duck (really)
  • Forget about a computer; how would you solve this with a pencil and paper?
  • Think out loud
  • ExplainGive a detailed account including reasons or causes. the problem to a friend

Real world problems require research

In this case domain knowledge is lacking. Additional research on the task is required. It may be as simple as looking up a formula; finding rules for a game; etc.[4]

For example, if you are asked to solve a problem by writing a program which converts celsius to fahrenheit you might have not memorized the formula.

New Language Features

A different kind of research is needed here. Students can look up information in their text books or online about how some task can be accomplished in the programming language being used. Alternatively, they may need to consider how the problem can be represented using numbers and string or collections of them. Or, they might be encouraged to ask the teacher![5]

Debug your code

There are different techniques you can use when debugging your code. Most of them can be distilled to a few simple techniques:

  1. Look for error or warnings in your IDE (probably the fastest way to spot silly mistakes)
  2. Read error logs
  3. Walk away for a few minutes.
  4. ExplainGive a detailed account including reasons or causes. the problem to a friend

I encourage students to open a new tab in their terminal window. The command below will create a running listGive a sequence of brief answers with no explanation. of errors. To escape from the output, push the key combination control-C.

tail -f /var/log/php/error.log

Click the image to learn about common mistakes

You must learn to solve problems.

References

  1. http://www.cs.uni.edu/~east/
  2. http://www.cs.uni.edu/~east/PcPI/prose_2.0.php
  3. http://www.cs.uni.edu/~east/PcPI/prose_2.0.php
  4. http://www.cs.uni.edu/~east/PcPI/prose_2.0.php
  5. http://www.cs.uni.edu/~east/PcPI/prose_2.0.php