How to Improve Coding Comprehension Using Peer Instruction

How to Improve Coding Comprehension Using Peer Instruction Featured Image

This semester, I added a new teaching technique to my classroom, and I wanted to share it with the world. In this article, I’ll be covering peer instruction and why you should add it to your coding courses.

In short, peer instruction is a teaching technique which leverages classroom assessment and small group discussions to reduce student failure rates and increase student retention. It can be used in a Computer Science setting to address misconceptions, strengthen understanding, and build social connections. In the remainder of this article, we’ll take a look at the details of peer instruction, and I’ll even provide an example of where I use it in my current class.

Table of Contents

What Is Peer Instruction?

At a high level, peer instruction is any activity where students work together to a solve a problem. However, for the purposes of this article, peer instruction is actually a specific process which you can follow in your classes.

First, introduce a concept as you usually would through a short lecture. For example, you might be talking about looping in Computer Science. As usual, you might show a flow chart which gives a nice overview of how looping works. Likewise, you might share real-world examples of looping like the repetitive process of washing dishes.

After introducing the concept, you then share a multiple-choice question (sometimes called a clicker question) to the class. Ideally, this question would target some misconception. For example, with a loop question, you could ask how many times an example loop executes and include off-by-one answers as traps.

When the students are finished choosing their answers, you may share the distribution of responses. Of course, some sources recommend keeping the distribution secretOpens in a new tab. as it may affect the outcome of the activity. If you do share the distribution, I would expect to see some diverging results. At that point, ask the students to discuss their answers in small groups.

After a few minutes, reconvene and take another vote. Hopefully, the students will have converged on the correct answer. That’s the power of peer instruction!

In any case, take some time to debrief and cover all the possible answers. Discuss the misconceptions and ensure students have a strong conceptual understanding of the problem before moving on.

When to Use Peer Instruction?

Peer instruction is a great tool to use when you want to address misconceptions but don’t have the time to work out all of them in a lecture. Instead, you can create a question which includes answers for several misconceptions. Then, you let the students work them out together.

The beauty of this technique is that students can address their questions with each other in small groups. As a result, you don’t have to worry about fielding all the questions in a lecture setting. In other words, it can save you time. In addition, it gives students a safer environment to ask questions, so students who might not typically raise their hands are getting their questions answered anyway.

If you’re worried not all students are going to get the same level of education using peer instruction, you can always try arranging groups. If you know your students well enough, you can manufacture certain dynamics which will allow all students to take advantage of peer instruction.

Finally, peer instruction is a great way to get students building connections. As a result, you might get some value out if it in classes that have mandatory group work. That way, students are already comfortable with their peers before you throw them off into the deep end.

How Often to Use Peer Instruction?

I like to weave in peer instruction several times a lecture. For a 55 minute lecture, I can probably get value out of 3 or more of these activities per lecture (i.e. one activity per 15 minutes). Of course, that might not be practical for your content, so you’ll have to experiment.

As an example, if I am teaching a lecture on branching, I might ask a conceptual question about branching terminology—especially if they’ve done some reading ahead of time. Then, at the midpoint of the lecture, I might ask about boolean expressions. Finally, at the end of the lecture, I might ask about different types of if statements:

  • Independent if statements
  • Nested if statements
  • Unreachable branches

In the end, the goal is to verify understanding throughout the lecture, so you know students are prepared for their assignments and exams. As instructors, we often blame our students for not studying hard enough, but it’s really our job to ensure they’re learning what we want them to learn. Peer instruction is just another way to verify that.

All that said, you don’t necessarily want to force these activities on your students. Instead, ask questions periodically to check in. Like anything, you can definitely overdo peer instruction. In other words, it’s a good idea to try to get a feel for whether or not your students are getting value out of the activity. If not, it’s probably a good idea to cut back.

Why Use Peer Instruction?

Now, we get to the hard question! Why should someone choose to add peer instruction to their classroom? Well, as it turns out, peer instruction has a ton of amazing benefits. According to Dr. Leo Porter of UC San DiegoOpens in a new tab., peer instruction has been shown to “to improve student scores on final exams, dramatically reduce student failure rates, and contribute to increased retention of majors.”

If you’re not interested in those benefits, you may find that students would prefer you add peer instruction to your class anyway. According to Dr. Porter, “students report valuing PI in their classes and wish more faculty would use it.”

Even if these benefits aren’t enticing to you, I think peer instruction is just a great way to spice up the traditional lecture. After all, students don’t enjoy listening to someone talk for an hour, so activities like peer instruction can be used to make classes more engaging.

Finally, I think Dr. Beth Simon said it bestOpens in a new tab.:

The question I get most often is: “But how do you find time to cover all the material?” Covering the material isn’t the goal — uncovering how to *think* like a computer scientist is the goal.

Why “cover all the material” when you can teach students the skills needed to learn the material themselves? This quote really resonates with me.

What Can Go Wrong?

When it comes to setting up your classroom around peer instruction, there are things that can go wrong. For example, a question might not be very clear. As a result, students may be confused, so they’re more likely to guess without actually thinking about an answer. Likewise, it’s possible that a vague question could lead to multiple possible answers.

In scenarios like these, you need to be able to roll with the punches. For instance, if a vague question leads to confusion, leave that question open to fruitful discussion. That way, the activity isn’t a waste of time. Instead, discuss why the question was confusing or unclear and ask students what information was missing.

Another issue that can come up is a question is just too easy. When that happens, students are likely to converge on the correct answer right away. In this case, I like to take the opportunity to discuss the misconceptions as a class. That way, there’s still plenty to learn.

Finally, sometimes students don’t want to work together. For instance, maybe I open up the discussion portion of peer instruction, and everyone in the class stays quiet. For me, this usually happens at the beginning and the end of a semester. At the beginning of a semester, I like to open up peer instruction with a fun personal question which students can use as an ice breaker:

  • Do you have any pets? If so, what are they?
  • What is your favorite snack food?

At the end of the semester, I usually run into the issue of students missing class. As a result, the seating is a bit sparse, so students aren’t necessarily close enough to have discussions. To deal with this, I might count off at the beginning of class, so students have groups.

In any case, the problems I’ve seen with peer instruction are limited, so they shouldn’t be too hard to navigate.

Peer Instruction in Action

At this point, I wanted to share exactly how I run this activity using an example question. For context, I use a platform called TopHatOpens in a new tab. which allows me to present a set of slides with various interactive elements throughout.

That said, these activities can be done using traditional slides and low-tech voting like holding up a number of fingers or using some paper print out. Of course, anonymous voting is ideal.

Step 1: Introduce the Content

For this particular activity, I was covering while loops in Java. Since students were already expected to understand while loops, we spent most of class tracing a complicated while loop:

int i = 4, j = 1, n = 0;
while (i < j) {
    if (n % 2 == 0) {
    } else {

In this example, I asked students to step through every line of code until the program was finished. At that point, I asked them to get a feel for what they thought this snippet was doing. If I recall correctly, it computes the midpoint between i and j as well as their difference using n.

Step 2: Pose a Question

At the end of this lesson, I presented another loop to students:

int x = 0;
int i = 1;
while (i < 5) {
    x += i;

At this point, I asked the students to tell me: “What value does x have at the end of the following loop?” Then, I provided the following options:

  • A: 15
  • B: 10
  • C: 6
  • D: 11

Each of these options were selected based on possible mistakes that the students could make throughout the process. For example, students might think that the loop iterates 5 times, so x is 15. On the flip side, students might think the loop iterates 3 times, so x is 6. Each of these options is an example of an off-by-one error. Finally, students might accidentally swap the initial values of x and i, so their final answer could be 11.

Step 3: Start Small Group Discussions

After students make their choices, I like to share the distribution, so they can see that they aren’t the only ones that are confused. Ideally, this allows students to feel more comfortable with sharing their thoughts.

Once everyone has seen the distribution, I usually ask students to get into small groups to discuss their thoughts. Personally, I don’t form groups for students, but I have noticed that some students simply won’t participate if I don’t. That said, part of me feels like that’s their choice, so I don’t usually bother forcing students to work together.

Another thing I like to do is wander the classroom while listening to discussion. This serves two purposes:

  • It keeps students on task.
  • It allows you to intervene if discussions are just plain wrong.

In this particular case, I might hover around the classroom and listen for thoughts that don’t mesh with the looping topic. For example, a group might argue that the answer is 15 because the loop breaks after i hits 5. Since that is a fundamental misunderstanding about how loop conditions work, it might deserve some intervention.

At any rate, after a couple minutes, you’ll want to call the discussion to a close. I can usually tell when to stop when there’s a lull in the discussions. If you don’t catch your students there, you may have trouble getting them to regroup. In any case, I like to toss my students a warning when I’m about ready to move on.

Step 4: Revote and Debrief

With the discussion out of the way, I usually take a revote to ensure that the discussions were fruitful. In this case, I would expect students responses to converge on the correct answer of 10.

If everything goes according to plan, I like to have a short debrief where I go over all the possible answers and discuss why some answers may have seemed enticing at first. While I’m glad that students now have the right answer, I’m more interested in making sure that students understand why the other options are wrong.

If for some reason the answers don’t converge, this is a great opportunity to figure out why there is a misunderstanding. While I haven’t personally experienced that, I imagine it would be a great chance to show another example and perhaps revote a third time.

At the end of this process, you should feel comfortable with your students’ understanding of the concept. If not, it may be time to step back and revisit the fundamentals. Otherwise, push forward!

Want to Learn More?

While I’m a firm believer in peer instruction, it was only three months ago that I heard about it for the first time. If you’re interested in learning more about the technique, there are tons of peer instruction resources out there. I’ll start by sharing a few resources by the folks who taught me about it:

If you’re interested in other Computer Science Education resources, check out some of these books on Amazon:

Finally, you’re welcome to stick around and check out some more of my work:

As always, thanks for stopping by. If you’d like more content like this hitting your inbox, hop on my mailing list. In addition, you can help even more by becoming a patronOpens in a new tab.. In either case, I appreciate the support!

Jeremy Grifski

Jeremy grew up in a small town where he enjoyed playing soccer and video games, practicing taekwondo, and trading Pokémon cards. Once out of the nest, he pursued a Bachelors in Computer Engineering with a minor in Game Design. After college, he spent about two years writing software for a major engineering company. Then, he earned a master's in Computer Science and Engineering. Today, he pursues a PhD in Engineering Education in order to ultimately land a teaching gig. In his spare time, Jeremy enjoys spending time with his wife, playing Overwatch and Phantasy Star Online 2, practicing trombone, watching Penguins hockey, and traveling the world.

Recent Posts