Students (and all of us!) will sometimes get stuck. This article walks through some strategies to help students without taking over and showing them the answer.
How to help stuck students
In Computer Science, lots of answers can be correct. As students learn more and more skills, they will learn that there are more and more ways to solve problems, and sometimes all can be considered correct. When analyzing code, ask students:
Did it run as expected? If you wrote a program to add 2 + 2 and it gave you 4, it’s probably working right!
Are we using lesson skills? If students just learned about while loops but don’t use them in the next problem, they may have the right answer, but not the most useful right answer.
If something went wrong, what’s the error?
A Simple Debugging Protocol
As a teacher, it can feel that you need to have all the answers. Yet in Computer Science, a field that is ever changing and evolving, that's an impossible ask for even the most talented software developer.
Instead of focusing on always knowing the answer, you can shift your mindset to focusing on teaching students problem-solving skills and perseverance when they’re stuck.
In this simple debugging protocol, you do very little instructing; the main role is to ask questions that will guide students towards the answer. You might even be learning along with them (which is awesome)!
1. Ask the student what they are seeing go wrong.
Is the code not running as expected? If the code runs, but 2 + 2 is giving you 22 instead of 4, this is an indication that there is a logic issue or missed step somewhere that can be reevaluated. The computer is doing exactly what it's been told to do, but the instructions did not do what the programmer intended.
Are there errors, and if so, what are they? This indicates that the code is not written in a way the computer can understand. Our guide to debugging can be helpful at identifying exactly what might be wrong.
2. Ask the student what they think the error code might mean, OR why they think it may not be running as expected.
If it's not running as expected, ask:
Where do we see the line of code that is making this happen?
Where should occur in your code? What's there instead?
If it's an error, ask:
What line number is in the error, and what does the console say is wrong?
Encourage students to look back at their resources: why is this problem different than the last?
3. If they're not sure, Google it together!
Say: "Hm, that's an interesting one. Let's look that up to double-check that we know what to look for."
Stay with the student as they Google so you can parse sources and answers with them. This is where, as a teacher, you can help students make sense of what they're seeing, even if you are learning it along with them. You can collaborate to figure it out together!
4. Look at the code, but let the student drive.
It can be SO tempting to “drive” and add that missing colon in the student’s code, but let students learn from themselves.
Give specific directions. Say things like, "I see something on line 5 that looks suspicious." Ask students to utilize shoulder partners for fresh eyes if they don't see the mistake.
Is the student really struggling? Walk them through corrections verbally. "Put your cursor between the p and the quotation mark on line 7 and..."
5. Ask students after they solve: What was the mistake? How can we make sure that next time we make a new, better mistake?
If you're using an error scoreboard in class, give it a tally - you did good work and learned from something that went wrong, and that should always be celebrated!