Ten Strategies for Preventing Cheating in Coding Class – zyBooks Guide

Avatar photo zyBooks Staff

Here at zyBooks, we’re getting more questions about cheating than ever before. Why? 

In a word, ChatGPT

But the explosion of generative AI is only magnifying a cheating problem that has been bedeviling computer science educators for years. 

From homework websites such as Chegg to public GitHub repositories to online cheating contractors trolling Reddit (who sometimes later blackmail the students who hire them), to now — ChatGPT — it’s never been easier for students to find answers to their coding assignments.

The scale of the problem is staggering. In our research, we’ve found numerous university programming classes where over 50% of students have engaged in cheating and academic dishonesty.

So what’s a programming instructor to do? 

In this post, we share with you ten strategies that you can use in your classroom now that have been shown to substantially reduce cheating


In this post: 

A Focus on Preventing Cheating 
Why Do Students Cheat?
Success Starts with Transparency
zyBooks Research on Academic Integrity and Preventing Cheating
Ten Strategies:

  1. Scaffolded Content
  2. Many Small Programs
  3. Normalize Help
  4. Pair/Group Work
  5. Rapport
  6. Integrity Talk and Quiz
  7. Show Cheating Prevention Tools
  8. Proctor
  9. Regret Clause
  10. Learning Assistants

zyBooks Cheating Prevention Tools in Action
Final Thoughts


The strategies we share in this post were developed by Dr. Frank Vahid, zyBooks’ co-founder and Chief Learning Officer. Dr. Vahid is a veteran computer science professor at the University of California, Riverside (UCR), the chair of UCR’s Academic Integrity Committee, and one of the nation’s leading researchers into cheating and academic integrity in computer science studies.

Dr. Vahid’s groundbreaking work underlies everything we’re sharing with you in this guide. 

First, let’s be clear: We’re not promising that these strategies will eliminate cheating entirely. But they will greatly diminish the problem. And they work for both in-person and online classes. In fact, Dr. Vahid found that once he implemented these steps in his own classes, cheating dropped from around 30% to under 10% — a significant improvement. 

We’re not promising that the strategies we share will eliminate cheating entirely. But they will greatly diminish the problem. And they work for both in-person and online classes.

Before we jump into the strategies, let’s briefly talk about the instructors’ mindset, why students cheat in the first place — and why transparency in your classroom is critical. 

A Focus on Preventing Cheating 

When Dr. Vahid speaks to educators around the country, his message is simple yet surprisingly effective: 

Shift your emphasis from catching cheaters to preventing cheating in the first place.

Adopting this mindset is crucial. When you focus on prevention, students keep learning, stay on track, and stay out of trouble. And it benefits instructors by saving them many hours a week of extra work, not to mention the headache of playing endless rounds of coding cop whack-a-mole. 

We’ve also found, counterintuitively, that by focusing on prevention, students are inspired to do even more work than required. 

Why Do Students Cheat? 

So why do students cheat in the first place? 

The Fraud Triangle is an effective framework to examine this issue and categorize efforts for preventing cheating. The triangle, originally developed by criminologists in the 1970s and adopted by Princeton University professor Ibrahim Albluwi as a way to think about cheating in programming, highlights the three factors that must be present for fraud (or cheating) to happen: 

  • Pressure – “I need that A to get into grad school.” 
  • Opportunity – “I can get away with it;” “ChatGPT will give me the answer.”
  • Rationalization – “Everyone’s doing it;” “The class is too hard;” or “I’ll learn this on the job.” 

In the following clip, Dr. Vahid explains the thinking behind this framework:

At this point, you might be asking yourself, why is this my — the instructor’s — problem? 

That’s a valid question, but students hurting themselves is not the entire story. Grades matter, of course, and we have to do everything we can to maintain their integrity. And as Dr. Vahid says in the video, the bulk of your students are still young and their brains are not fully developed; we can and should help them. 

Success starts with transparency

Let’s repeat that: Success starts with transparency. 

What does that mean? 

  • Aim to organize your class really well.
  • Be clear about what students need to do.
  • Keep the cadence of your class the same every week.
  • If you’re using zyBooks, we recommend you configure the zyBook to cover one chapter per week.

By being totally transparent in your classroom you’re removing fear, managing expectations, and helping to build your students’ confidence. Yeah, they can do this!


zyBooks research on academic integrity and preventing cheating:

Detecting possible cheating in programming courses using drastic code change

Understanding and promoting earnest completion in online textbooks

Impact of Several Low-Effort Cheating-Reduction Methods in a CS1 Class


Now, here are ten concrete steps to breaking the fraud triangle in computer science education, even now, in the age of ChatGPT: 

1. Scaffolded Content

Reduces Pressure

Reduces Rationalization

Lecturing the old-fashioned way doesn’t work. Dumping a mountain of information on students is akin to an outdated “throw them into the deep end of the pool” approach to learning. Why not help students learn to swim by giving them lessons as they wade out into the water, so by the time they get to the proverbial deep end they’re swimming, not drowning? 

What this translates to in practical terms is breaking up learning into little chunks with lots of feedback and instruction. Pedagogically speaking, we’re talking about scaffolding your instruction. 

Lots of feedback is key. 

Scaffolding transforms classes, giving students ongoing opportunities to learn by doing. You don’t master piano by just reading about it; the same is true with coding, of course. 

Scaffolded learning is at the core of the zyBooks approach and built into the platform. Scaffolding removes pressure, because by practicing with many small coding problems, students are better prepared for bigger assignments. And it tamps down rationalizations to cheat, such as the class is “too hard.”

2. Many Small Programs

Reduces Pressure

Swapping one big coding assignment with many small programs (“MSP”) yields dramatic results, especially with foundational computer science courses such as CS1 and CS2. Here’s why:

  • Students write a lot more code, so they practice more often.
  • Students get to work sooner instead of procrastinating; MSP looks less intimidating than one big program.
  • If students get stuck on one assignment, they can start on another small program, which helps remove the temptation to cheat.

The MSP approach builds confidence and reduces stress. (It’s also a foundational zyBooks concept.) Practicing a bunch of loops is like working on your tennis serve — the more the better. And with autograding, which is built into zyBooks, instructors aren’t drowning in tons of assignments to mark up. 


Related posts

Dr. Cay Horstmann: Three Key Insights for Teaching Programming

The Power of Many Small Problems in Engineering

A Better Way to Assign Homework in Engineering 


3. Normalize Help

Reduces Pressure

Set up discussion forums, like a real-time Discord server, Slack channel, or a Piazza forum for your classes. The idea is to establish that help is normal and easily available, even outside of regular office hours. 

Get your students talking to each other if they get stuck. Explain the legitimate ways they can help each other (see Step 6 below). 


Related post

Call Them “Student Hours” – A New Approach to Office Hours


4. Pair/Group Work

Reduces Pressure

With this approach, students pair up (or you pair them up) to work on programming assignments together. There’s a methodology here: One person types while the other person watches, then they switch, and they keep switching throughout the assignment. 

It’s a powerful mechanism. Students have been shown to both do better in class and retain more knowledge, and failure rates drop dramatically as a result of working together. The drawbacks with this approach are with freeloaders who don’t actually do anything, and students who, conversely, want to do everything themselves. But there are ways to address both drawbacks.

5. Rapport

Reduces Rationalization 

Knowing how to connect with your students is as important as mastery of your material. When you build rapport with your students, you’ll see significant improvement in their grades and retention rates.

Bottom line: If you care, they’ll care. And by connecting with students, you’re diminishing a key rationalization for cheating: The professor just “doesn’t get it.” 

6. Integrity Talk and Quiz

Reduces Opportunity

On the first day of class, nobody is thinking about cheating. So discussing it at the dawn of the semester will go over students’ heads. But by the third week? Different story. This is the time to present your class with a 20-minute talk on academic integrity, followed by an “integrity quiz.” 

Promoted by Professor Max Chou at UC Irvine, the integrity quiz is an explicit review of what is and is not allowed in class. For his own integrity quiz, Dr. Vahid creates a section in his zyBooks course to ask questions such as: 

  • Are you allowed to show buggy code to a classmate who’s helping me? (Yes)
  • Is a student with working code allowed to show their work to a classmate who’s struggling? (No)
  • Can you use ChatGPT to write your code or post to Chegg? (Absolutely not!)

Students must score 100% on the quiz to move forward in class. They can retake the quiz until they achieve a perfect score, but students must ace the quiz to submit further assignments. 

Aside from framing what’s permissible, the integrity talk and quiz help clarify genuine misunderstandings and gray areas. And they serve as a baseline if you find violations at some point later. 

Remind your students about integrity with another 20-minute talk in Week 6 of this course, just to keep it front of mind. 

7. Show Cheating Prevention Tools

Reduces Opportunity

When you zip past a police cruiser idling on a highway shoulder, what happens? You slow down, of course, rather than risk seeing flashing red lights in the rearview mirror. 

The same idea can be applied to cheating prevention tools. 

The three powerful tools we introduce below can help you determine if your students are plagiarizing code. But they’re most effective when you use them like that police cruiser: to help deter cheating in the first place. 

For our purposes, the “cruiser idling on the shoulder” is you demonstrating these tools throughout the term, as we’ll talk about shortly. 

Similarity Checker 

The first tool is the MOSS algorithm, which is integrated into the zyBooks Similarity Checker tool. MOSS, or Measure of Software Similarity, is an application developed at Stanford University and is now used by thousands of schools across the country. The tool automatically compares your students’ code submissions and flags suspicious similarities. It doesn’t get fooled by things like tweaking the variables or white space. 

MOSS has proven to be extremely effective at catching cheaters. But here’s a more powerful way to use this tool:

Incorporate the Similarity Checker into class in a fun way.

Why? By demonstrating the tool and building it into the learning experience, you’re reminding students that, yes, they can get caught cheating! 

Important note: Just warning students doesn’t work (in one ear, out the other). You have to actually show them the tool. Remember that police cruiser? 

Roll out the Similarity Checker in Week 4 of the semester, after the integrity quiz. Demonstrate it with a low-stakes programming task in a fun way that gets the message across.

In later classes, use the anonymizing option to pull up actual assignments and discuss how students came up with “similar ways” to solve the problem. These subsequent demos are a two-fer: You’re teaching code by reviewing student work, while at the same time telegraphing how easy it is to catch cheaters. 

Coding Trail

Another useful prevention tool is zyBooks’ Coding Trail functionality.

With the platform’s online autograder, every student’s action is recorded when they run code on their own or submit it for grading. And the students can see this record, so they know exactly how much work they’ve done. 

The message to the student here is that effort matters and process matters. And you as the instructor can quickly deduce from the effort and process if a student is likely cheating. 

Like with the Similarity Checker, we recommend you display Coding Trails to your classes in Week 4 of the semester. The demonstration also serves the same purpose as that cruiser parked on the shoulder: Better not speed, the radar gun’s got a beam on you. For your students, the Coding Trail takeaway is, “Wow, my professor can see my code and how hard I’m working. Better not cheat.”

Lastly, Coding Trails offers another valuable benefit: It gives you insight into which students are struggling with the material, so you can intervene early and help them.

Playback History

Finally, zyBooks’ Playback History is now available in the new Advanced zyLabs, Playback History shows you exactly what a student has entered into their assignment, character by character. So you can see every development run a student has completed, whether blocks of code were copied and pasted in, and even who’s edited the code, including activity from your TA.

Why is this important? If the Similarity Checker reveals suspicious activity, you can drill down further with Playback History and investigate how a student solved the problem.

As with the other two tools, we recommend you walk through the Playback History with your class in Week 4 of the semester. 


zyBooks Cheating Prevention Tools in Action

In this video, zyBooks’ product development lead and veteran computer science educator Joe Mazzone explains how zyBooks’ cheating prevention tools work:


8. Proctor

Reduces Opportunity

The most effective way to prevent cheating, of course, is for students to complete their work in person under the watchful eyes of instructors. But proctoring every student assignment? Well, not happening. Nevertheless, proctoring should play a key role in your courses.

9. Regret Clause

Reduces Pressure

Reduces Rationalization 

The regret clause has been promoted by Professor David Malan of Harvard University. A few years ago he faced a major cheating scandal in his CS1 course. What he realized from the experience is that cheating often happens during a late-night panic with deadlines looming. The student is sleep deprived, stressed out, and makes bad choices. And once they submit their plagiarized assignment, there’s no way out. 

But what if you gave students a way out? 

Enter the regret clause. Dr. Malan gives students 72 hours after submitting their assignments to admit cheating. They’ll get a zero for that work, but it won’t be reported as academic dishonesty.

Another approach is to offer a regret clause through a form that students fill out. The form allows them to withdraw programming assignment submissions. Give students the chance to resubmit their work without facing academic dishonesty penalties. 

10. Learning Assistants

Reduces Pressure

Finally, in learning assistant programs, upperclassmen are trained to help lowerclassmen with their coursework. 

The benefits here flow in both directions. For the upperclassmen, the pride of being part of this group and teaching others helps reinforce their own knowledge. For lowerclassmen, the opportunity to talk freely to fellow students who’ve been through their classes relieves pressure. 

These programs are proven to be very effective, and they’re popular at many schools across the country.

Final thoughts

We hope you find these strategies useful. To reiterate: we cannot eliminate cheating entirely. But now, despite the ability of ChatGPT to pump out code at the drop of a prompt, we still have the power as instructors to overcome this apparent threat to teaching. 

First, design your courses using the prevention approaches we discuss above. The more successful you are at breaking the fraud triangle, the more students will understand that they have to do the work and will likely get caught if they cheat, even if they use ChatGPT. 

Keep in mind, too, that developing rapport with your students is even more critical now. If your students understand that everything you’re doing is motivated by a sense of fairness, they’ll likely respond in kind. 

And second, remember that we’re still in the Commodore 64-early days in the world of AI. We have the power and creativity to harness and weave the abilities of AI into how we teach and prepare students for success. That’s already happening, and it’s exciting! 


Related post

The ChatGPT Wakeup Call to Deal with Cheating 


If you have any comments, thoughts, or want to share other cheating prevention strategies you use in your own courses, we’d love to hear from you! Email us at officehours@zybooks.com

Avatar photo
Author Bio

zyBooks Staff