Developers rarely face a single way to solve a problem. More often, they are presented with multiple implementations that come from libraries, repositories, online forums, and, increasingly, from code suggested by large language models. For students preparing to enter this landscape, it is not enough to write code that simply works; they must also learn how to compare and evaluate competing solutions. This skill, termed comparative comprehension in recent work (2022), captures the ability to reason about similarities, differences, and trade-offs among code alternatives.
This dissertation draws on insights from developmental psychology and mathematics education, where structured comparisons have been shown to deepen students’ procedural knowledge and flexibility. I adapt these ideas to computer science education by designing and studying instructional materials for CS1 that integrate structured code comparisons. The goal is to help students first understand the similarities and differences between code alternatives—developing their comparative comprehension—which can then support more strategic and adaptable problem solving, or procedural flexibility. In particular, I investigate how these materials can support students in learning Snap!, in transitioning from Snap! to Python, and in developing their comparative comprehension.