National Math + Science Initiative Blog


Students Learn the (Computer) Science of PB&J Sandwiches

Briana Guevara walked into her AP Computer Science classroom with a cart in tow, on the cart she had all the makings for a peanut butter and jelly sandwich. They’re not for her lunch, but rather to teach a lesson about coding.

Because the first thing everyone thinks about in Computer Science is PB&J sandwiches.

“I ask the students to write me a very specific set of instructions on how to make the sandwich,” Guevara explained. “As I read through the instructions, I make it exactly as they tell me to.”

Guevara proceeds with the first set of instructions. ‘Take a piece of bread’ is what the card reads, so she reaches into the bread bag and rips off a small corner of a bread slice. Her students start to protest as she continues, squirting a large amount of jelly on the sandwich. The end product is disproportionate and messy, but the lesson her students learn is clear: Clarity and precision are important..

Guevara uses the sandwich to teach her students about algorithms, a set of instructions given to a computer that allows it to perform a task. The sandwich exercise is one of the many ways that teachers, like Guevara, are thinking outside the box to teach computer science to students.

“My students still refer back to the peanut butter and jelly lesson,” Guevara said. “It taught them how specific they need to be when writing algorithms. They always ask if they need to be as specific as they were in that particular lesson.”

Guevara is a new AP computer science teacher. She made the switch after using a beginner computer science program, Boostrap, to teach a concept in her Algebra class.

“I saw how interested the students were [in computer science] and how naturally engaging it was,” Guevara said. “I was really drawn in by that and by the connections that can be made between computer science and other subjects.”

There is a computer science connection in every field, and it is relevant in any career path a student may be interested in pursuing.

This is the first year AP computer science, as well as computer science principles, is being offered at John Marshall School of Information Technology in Cleveland, Ohio, with support from NMSI’s College Readiness Program. And so far the results have been outstanding.

“For many of my students this is the first time they’re taking a course that really challenges them,” Guevara said. “So, it’s a learning experience that can sometimes be frustrating, but at the end of the day when they accomplish that goal, and get their code to work, the feeling of accomplishment they get is unlike anything else.”

For Guevara, preparing her students for the jobs of the future sometimes means relying on the community to tell their stories and experiences in computer science.

“Our community is really involved,” Guevara said. “It really allows my students to be exposed several different career options that they may not have realized require skills they are learning in class.”

 While taking computer science courses, students are being exposed to valuable skills, like creative problem solving and critical thinking that will help them in their careers further down the line.

“Computer science relates to everything and every single career path,” Guevara said. “There are jobs that are not even career options, yet, but that will require a strong knowledge of computer science to succeed.”

During Computer Science Education Week, NMSI celebrates computer science educators like Ms. Guevara, students and mentors, and countless professionals who are applying CS in their daily work. Follow along on our blog and on twitter to see what’s going on across the nation. And, if you have a great story, please share it with us on social media. You can join the conversation for both by using #NMSI. 

blog comments powered by Disqus

Classroom-Ready Resources

Looking for rigorous teacher training? Need free classroom-ready resources? We’ve got you covered.

Don't worry! We hate spam and your information will never be shared with any third party.
* Required