Programming Thinking Skills Explained
with a Sandwich

created for free distribution by: www.onlineschoolclassroom.com

Programming courses are a great way for any student to grow in critical thinking and problem solving skills and become a more active learner. A good exercise to show this and demystify programming is by evaluating a common, everyday task as a programming problem. Take a routine task, find its rational steps, and then solve it using those steps. In programming, this is how one can approach any problem. The possible solution is broken down into logical steps, programming elements are used to implement each step (loops, if-then, input, output, etc), and then the steps are written in the desired language combining them to solve the problem. If the implemented solution does not meet the problem’s requirements, evaluation of each step will reveal where errors exist and how to fix them.

Let’s look at this process by creating a sandwich.

First, (form a solution) think of the steps to create a sandwich. You have access to a loaf of bread, turkey slices, ham slices, cheese slices, mustard in a squeeze bottle, a knife, lettuce, mayonnaise in a jar, and a plate.

Second, (write your solution) list out your steps in a 1, 2, 3, type approach. Be sure and think of different variables that could occur while making a sandwich. For example, is it for someone else and you need his or her input (user input steps) or is it for yourself and you already know how you want it (hard coded info)?

Third, (analyze solution) check over the list and see if the logic is correct.

Fourth, (run your solution) give your list and the sandwich materials to someone else. Tell them to follow the steps EXACTLY to create the sandwich. Let them know if something is not explicit, that they should only do what the step says and not infer anything.

Fifth, (evaluate solution) look at how the sandwich turned out. Most likely it has some errors, like the mayonnaise on the outside, cheese still in its wrapper, 3 pieces of bread, etc. These are areas to look back at the steps and see what needs to be changed or added to make a more correct solution.


From this exercise, as in programming, many solutions can arrive at the same outcome or slightly different outcomes, and are still correct. There is room for creativity, personal preference, and better efficiency in almost every problem solution. However, the logic of each step must be precise for a correct solution to occur. If a simple logical step is left out, the solution will have errors.

Programming helps in developing thorough thinking skills by forecasting solutions, implementing them and reflecting upon their success. This is a great model for learning and developing good thinking skills; and in learning programming, it is an inherent benefit.