Back to computer sciencecomputing use cases

Computer ScienceComputingHigh schoolKey Stages 4 and 5

How to use AI to teach computer science

To use AI to teach computer science, put the concept and a check question in your lesson plan, then let an AI tutor explain it at each student's level and show you who understood. A free Flint activity on how malware spreads comes with this guide.

Title card reading 'How to use AI to teach computer science', next to three students' chat cards that explain how a worm spreads with a video game, basketball and music example.

"Flint has been invaluable for introducing new concepts and assessing student understanding. My high flyers love how they can deep-dive into course content with an AI expert. Other students who need more attention can get a one-on-one tutor."

Matthew DavisMatthew Davis, Computer science teacher at The Episcopal Academy

Why this matters

In one computer science class, a student who has coded since middle school sits next to one opening a code editor for the first time. One explanation of a new concept loses both of them, and the teacher has to wait for quiz day to find out.

How to use AI in computer science lesson plans

In a computer science lesson plan, an AI tutor can do the part of differentiated instruction a teacher can't do for 30 students at once. Differentiated instruction is an approach in which teachers adjust their curriculum and instruction to maximize the learning of all students, assessing each student's readiness and grouping by needs and interests (IRIS Center, Vanderbilt University).

  1. Write the concept and one check question into the activity
  2. Have the AI tutor start at each student's level and explain with their interests
  3. Read who understood on the activity page before the next lesson

In this guide's activity, the concept is how a worm spreads. In the chats below, Sparky, Flint's AI tutor, asks each student what they already know, explains the worm with an example from their interest, and asks a check question before moving on.

One malware concept, explained to two different students

Both students are in the same activity, learning how a worm spreads. Each has their own chat with Sparky.

Sparky uses the student's interestSparky starts from what the student already knows
A

Ava

Interest: Video gamesStarting point: New to malware

Ava

I'm really into video games, and I don't really know what malware is yet.

Sparky

Let's start with what a virus is. A virus is like a sketchy mod: nothing happens until a player downloads it and opens it. A worm is like a bot that joins every server that skipped the update, on its own. Release the worm and see which servers it reaches.
An interactive Sparky made in the chat: 8 game servers. The worm has infected the 4 servers without the latest update, and the 4 updated servers show a lock.
InteractiveWorm outbreak on game servers

Understanding check

One laptop in the computer lab gets a worm. Half the laptops are missing the latest update, and nobody opens a file all day. Which laptops have the worm by the end of the day?

Ava

Only the first one. Nobody opened anything.

Sparky

A virus needs someone to open a file. A worm doesn't. In the simulator, which servers did the bot get into?

Ava

Oh. The ones missing the update.

Wrong first answer, right after one hint

M

Marcus

Interest: BasketballStarting point: Knows what a virus is

Marcus

I play basketball, and I already know what a virus is.

Sparky

Then you know a virus waits for someone to open an infected file. A worm plays like a full-court press: it hunts for computers missing a security update and gets into every one it finds.

Understanding check

Which defense stops a worm but does nothing against a virus?

Marcus

Installing every security update.

Sparky

Right. Here's a harder one. Microsoft released the fix for the WannaCry worm in March 2017. Watch this, then tell me why WannaCry still reached so many computers in May.
A 90-second narrated video Sparky made in the chat, titled Why WannaCry spread after the fix was out.
VideoWhy WannaCry kept spreading · 1:30

Skipped the basics, moved to a harder question

Ava's hint sends her back to the simulator she just tried. Marcus skips the definition he already knows and gets a harder question with a short video. Sparky can make interactive simulators, narrated videos and images inside a student's chat when a picture explains the idea better than text. The students and chats are examples we wrote for this page. In Flint, Sparky learns a student's interests from what the student says in the chat, and can save them as memories to use in later chats. Students can see and delete their own memories in Settings.

How to check for understanding across the class

Sparky checks each student's understanding as they go. The activity page shows who needs help right now, what the class understood, and what to reteach next.

Flint's activity page for a lesson called How malware spreads. Needs attention shows a live alert that one student gave up after three wrong answers. Activity analytics lists what the class understood, an area of improvement where 4 students still mix up worms and viruses, and a follow-up. The Sessions table shows two submitted students graded Proficient and one still in progress.

Example activity page

After a class works through the malware lesson

The school and students are made up for this page. Add a rubric and Sparky grades each chat for you.

Set up the activity for free

The malware activity is in Flint's public library, with Sparky's role, guidelines and greeting already written. Open it, duplicate it into a free Flint account, and assign it to a class. Every student gets their own chat with Sparky, and the activity page fills in as they work.

To have Sparky use each student's interests, as in the chats above, add this line to the activity's guidelines. It isn't in the library copy.

Example guideline

Before the first topic, ask the student what they're into outside class and whether they've learned about malware before. Explain each topic at that level, with an example from their interest, and ask one question to check their understanding before moving on.

For middle school, see how to run coding projects in middle school. For more computer science activities, see Flint for computer science.

Other use cases

See all use cases →

Learning feels different when it fits you.