Academic Programs

Where AP Computer Science meets PB&J

Skippy peanut butter. Welch’s grape jelly. Nature Valley granola bars. These are not the usual supplies for an AP Computer Science Principles class, but one look at the detailed instructions on the whiteboard shows that it’s clearly not Home Economics, either. In today’s lesson, teacher Michael Dimen brings true Holy Child ingenuity to his classroom by combining a hands-on lesson about coding with a service-oriented bonus: making brown bag lunches for Mayfield’s weekly Loaves and Fishes donation program.
The students push their desks together to create a makeshift assembly line. Their assignment: to teach a computer to make a peanut butter sandwich! In a manner of speaking, of course...

The students may not be coding on their screens today, but they are still learning how to write an algorithm. “Algorithms are a series of steps to accomplish some task,” explains Mr. Dimen. Today, their goal is to translate a real-life, human task into a formalized, step-based process that a computer can understand because, as Mr. Dimen says, “Computers don’t know anything about the world that you don’t tell them.”

Students are given two minutes at the whiteboard as a class to break down the PB&J-making process into discrete, unambiguous steps. Open jar, get knife, get peanut butter on knife…

It seems simple enough, but when Mr. Dimen follows their instructions to the letter (as a computer would) the process hits a snag almost immediately. The jar of peanut butter has an inner seal—a fact that was not explicitly laid out in the original algorithm—so the knife can’t get to the peanut butter. “We found a bug!” says Mr. Dimen and the class laughs. He reminds them this happens constantly in coding as well. “You can code as much as you want to, but until you test it, it doesn't mean anything.” The greatest minds have been undermined by a missing parenthesis. So the students, quite literally, go back to the drawing board.

Mr. Dimen thinks the peanut butter bug report is actually very much in line with the ethos of this class, a place in which making mistakes is not just destigmatized but encouraged. Computer science, and programming in particular, is not about finding “the right answer” but forging a brand new path. In this way Mr. Dimen thinks of computer science as less like a STEM course and “more like an art class” because it makes something that didn’t exist before. Programming is quite simply, he says, “the language of creation.”

This rigorous class isn’t all laughter and messy fingers, though, and some lessons are much more math-heavy. Sade Falese ’23 explains what motivated her to take this often rigorous course: “This subject is greatly developing our world and the systems created around it.” And, she adds, “I feel as if teenagers are constantly living around technology and computers, it is important to know how it works and to use these tools for good.”

For many students, this course is their very first exposure to coding in an academic setting. “I didn't have any background experience before this class,” Ellery Potter ‘24 explains, “but I took it because so much of our world runs on coding and I wanted to understand it better.” 

Other students, like Viola O'Beirne ‘24, have already decided they want careers in related fields. “I want to go into engineering and even if I am not the one coding, understanding code is important in that field of work,” she says.

Learning to code is certainly part of the curriculum, however, the fact that this class encompasses more than simple coding is why Mr. Dimen enjoys teaching it. He also sees the ways in which Holy Child principles deeply enrich this field of study. New scientific ideas can be “really amazing,” he says, but they also “don’t exist in a vacuum.” 

“The concept of something is neutral, but when a concept exists in the world it is no idea floating around,” says Mr. Dimen. With every new innovation comes the possibility of the abuse of that innovation, and he wants his students to ask the big questions themselves— what does this new thing “mean for the world...and who is this going to affect?” 

It seems the students are very clued in on those probing ideas. Viola explains, “We learn about the digital divide, which is about how there is such a separation between people who know how to use technology and those who don't, and how we can try to change it. We also discuss ethics in terms innovations.”

Mr. Dimen sees a lot of “aha” moments in his classroom. Ultimately, he hopes that students who take this course build the confidence to embark on ambitious projects, gain the tools to problem-solve in the face of uncertainty, and develop the moral maturity to question both the positive and negative ramifications of their work.

Back in the classroom, the students have finally devised a successful sandwich algorithm, and Mr. Dimen allocates the rest of the class time to making actual sandwiches for the next day’s Loaves and Fishes collection, which helps feed our neighbors at Union Station Homeless Services. The brown bag lunches are carefully loaded with juices, chips, snacks, desserts and the—now thoroughly bug tested!—PB & J sandwiches. 

This practice is another series of steps, this time, an algorithm for kindness. 
No comments have been posted
Established in 1931, Mayfield Senior School in Pasadena, CA is a Catholic, independent, college preparatory school for young women grades 9-12. Noted for its rigorous academic program, which includes 28 Advanced Placement and Honors courses, Mayfield’s curriculum is underscored by a philosophy of educating the “whole child,” which also encourages commitment to and excellence in the arts, athletics, community service and spiritual growth. The nurturing environment at Mayfield Senior School allows each student to flourish in an atmosphere of personal attention.