Main content
Resources
Course: Resources > Unit 1
Lesson 4: Computer programming teachers- Programming content overview
- Tracking progress of programming students
- Classroom debugging guide
- Pair programming in the classroom
- Teaching guide: Intro to JS - Drawing Basics
- Teaching guide: Intro to JS - Coloring
- Teaching guide: Intro to JS - Variables
- Teaching guide: Intro to JS - Animation basics
- Teaching guide: Intro to JS - Interactive Programs
- Teaching guide: Intro to JS - Resizing with variable expressions
- Teaching guide: Intro to JS - Text and strings
- Teaching guide: Intro to JS - Functions
- Teaching guide: Intro to JS - Logic and if statements
- Teaching guide: Intro to JS - Looping
- Teaching guide: Intro to JS - Arrays
- Teaching guide: Intro to JS - Objects
- Teaching guide: Intro to JS - Object-oriented design
- Programming classroom handouts
- Additional programming projects
- Lesson plans: teaching programming in the classroom
- Programming case study: Encouraging cross-disciplinary projects
- Programming case study: Going beyond the KA curriculum
- Programming case study: Teaching an elementary school class
© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice
Classroom debugging guide
If you're teaching a classroom of students learning programming, you may find students coming to you for help. You can use the tips below to talk through student questions together (to be their "rubber duck", as we call it)-- even if you aren't that familiar with programming yourself.
The general goal is to help the student become a better debugger, so they can help themselves when they're not in the classroom. Behind every good programmer lies a great debugger. :-)
If they don’t understand a challenge step:
- Ask the student to read the challenge step aloud.
- Ask the student to look at the hint code and contrast it to their code.
- Ask them to explain what their code is currently doing.
- Encourage them to try something out and see what happens.
- If they get very far off-path, remind them they can “Start Over”. Make sure they read each step carefully the second time around.
- Encourage the student to re-watch the previous talk-through, or skip to the end of it to see what the final code was. It is often similar to the challenge. Ask them read that code a loud and explain what it does. Have them modify it to see if it aids comprehension.
If they don’t understand a project description:
- Ask them to read a loud each step, and to stop at parts they don’t understand.
- Have them read through the starter code, line by line, and explain what each line does. If there’s something they don’t understand, have them check the documentation or re-watch the relevant talk-through.
- If you’re unable to help, remind them they can click “Request Help”. Make sure they ask their question descriptively.
If they don’t understand an error message (“Oh Noes”):
- Ask the student to read it a loud and to explain what they think it means.
- Make sure they click “show me where”, as it often points to the line of the error. It can sometimes be wrong, however, so the error might be an earlier line of code (usually not later).
- If the error message doesn’t make sense and there are multiple messages, click through them to see if other messages make sense.
- Encourage them to improve the indentation of their code (watch Readable Code for an explanation of that). Especially if they’re dealing with functions, for loops, or if conditions, proper indentation can make it easier to find errors with mismatched brackets, and to find logical errors.
If they don’t understand what their code or the starter code is doing:
- Have them go line by line and explain what they think each line does.
- Make them check the documentation for any keyword/function/global variable that they don’t understand. Click through to see the example and have them explain what the example does. They can try modifying the example program
- Encourage them to use println() to output the values of variables. Are they what they expected? If not, why? They might need to think through it on paper or println() other values to understand why.
If they think they did a challenge step correctly but it won’t pass them:
- It’s possible that their code is a correct solution but that the automated grader isn’t aware of it. In that case, please click “Report a problem” and have the student move on.
What other techniques do you use for debugging in the classroom? Tell us below!
Want to join the conversation?
- Do you have samples of JavaScript Code with errors in it that I could print out and use as an activity with my students to help them practice talking through the code with a fellow student?(4 votes)
- Awesome idea!
My go-to when I'm stuck is, "Hm, let's see...[access coach reports] Suzy has finished this challenge/project. Ask her to explain it to you--and then I want you to come explain it to me."(3 votes)
- Would it be possible for the
println
box to appear below the program instead of overlapping it? Sometimes you can't see or click on the bottom of the program when you are usingprintln
.(3 votes) - I have 5 students that started a mission with me last year but never finished. How do I delete the accounts, so they have to start over( all accounts were deleted), but when they signed in it started where they left off. HELP(2 votes)
- How doYou open dashboard ?🌉🇱🇷(1 vote)
- My students are working in Khan math under a username that is different from the one I assigned them. I can't see their work. What can I do?(1 vote)
- yes it really helped me do this program a lot better : ) p.s. its handy to get the kids to do there homework now(1 vote)