Asking Good Questions
If you still cannot find the bug in your code after using the strategies outlined in this chapter, do not hesitate to reach out to other programmers.
Whether you are asking your teaching assistant, another student, or a stranger in an online forum, you should first be able to answer the 3 questions outlined below.
Not only will these questions help others assist you more directly, but they may just lead you to the answer yourself!
What is the problem with your code?
Describe the error you are experiencing with as much detail as possible.
Bad: “My program is broken.”
Bad: “I’m getting this error.”
Good: “There is a ReferenceError on line 23, but it’s not clear to me what’s causing it.”
What have you done to try to address the problem?
Another programmer can glean a lot of information by hearing what you have already tried.
Bad: Asking for help immediately.
Bad: Using trial and error without any specific direction.
Good: “I added user input validation, but I am still seeing the problem.”
Where have you looked for an answer?
Bad: “I haven’t looked online at all.”
Bad: “I Googled ‘js range error’ and didn’t see anything.”
Good: “I Googled ‘js range error boolean expression’ and found a question on Stack Overflow that seemed relevant. I tried the recommended solution, but it didn’t fix my problem.”