One of the more isolated standards in the AP Computer Science Principles framework is 2.2.3F: A Logic Gate is a hardware abstraction that is modeled with a Boolean function. I find it super tricky to find a place in the curriculum to teach this without it feeling like a diversion from whatever unit or topic we’ve been talking about. I ended up teaching it around the time we did if-statements and conditional logic in our programming unit, but it still felt like a departure from the overall theme of the unit: we’ve been talking about high-level programming languages, but now we’re going to switch gears suddenly and talk about these random hardware-level components that relate more to binary than to programming.
Anyway – I took a half-day to teach these this year and I think it worked out pretty well. I started by having students follow along with me as we filled in some notes on the basic logic gate symbols and how they interact with True and False values. We do this part together mostly to keep the time spent on the guided notes short – the better part of this lesson comes after we’ve got the basics down.
After we do the first page together, students flip over to the back page and look confused because there aren’t any directions. Instead, I have several posters hanging around the room (posters are here, but you can really make up whatever you want), each drawn with a different colored marker to match the labels on their notes. I also have small stacks of post-its next to each poster – one stack is 4-5 post-its that say T, the other is a stack of 4-5 post-its that say F. All of this takes some planning and preparing ahead of time – I’m glad I had these classes after lunch so I could get all of this organized and setup then.
The task is for students to move around the room and create the resulting truth-table for each poster using the post-its to trace the resulting True of False value from each logic gate. For example, if a student is starting a poster with X having an initial value of True, then they’d put a T post-it on top of X. Similarly, if Y had an initial value of False, they’d put an F post-it on top of the Y. If X and Y are connected to an AND gate, then they’d move the T and F to the inputs of the AND gate, then move and F to the output of the AND gate (since it evaluates to False). Or, watch this student talk herself through one of the problems and make my heart sing with how well this activity turned out (fair warning: I yell something partway through the video – sorry about that).
Here are a few more pictures of what this looks like in practice:
When I did this activity, I had students complete 2 posters from the top row of 2-input problems, 1 poster from the bottom row of 3-input problems, which is probably all they need to get the hang of this concept. This also makes sure students aren’t all crowding around one poster, and giving choices to students seems to be a pretty solid teaching move in computer science classes.
I spent a half-day on this activity and it seemed like a fair amount of time considering how isolating the standard is and how much it’s represented on the AP exam. At the end of the period, I gave them 2 AP-style problems on logic gates. I can’t post them because of College Board rules, but embedded in the resources posted on the AP Course Audit there are 2 Logic Gates released problems, so teachers can find them if they know where to look.
The next day, we went back to working through conditional statements and Boolean logic in programming, which seemed to go a little smoother after talking about the logic gates.