In Wednesday’s CSCI111: Fundamental of Programming I class, the students wrote an algorithm for making a peanut butter and jelly sandwich. Fellow student Jean Paul Mugabe ’14 then attempted to make a PB&J sandwich using their algorithm. The students could not make any assumptions about what Jean Paul knew, and Jean Paul did exactly what they told him to do in the algorithm.
This exercise illustrates the importance of having unambiguous programming languages because computers cannot infer what we’re telling it to do. The exercise also motivates some important properties of algorithms, such as what data and operations we have available, naming, ordering steps, handling special cases, looping, and subroutines.