A program is a set of commands (also known as instructions or operations). When you write down directions to your house for a friend, you are writing a program. Your friend “executes” that program by following each instruction in turn.
Every program is written in terms of a few basic operations that its reader already understands. For example, the set of operations that your friend can understand might include the following: “Turn left at Darwin Street,” “Go forward three blocks,” and “If you get to the gas station, turn around—you’ve gone too far.”
Computers, unlike your friends, have a different set of operations. Some operations are mathematical, like “Take the square root of a number,” whereas others include “Read a line from the file named data.txt” and “Make a pixel blue.”
You can “teach” a computer new operations by defining them in terms of old ones. For example, you can teach the computer that “Take the average” means “Add up the numbers in a sequence and divide by the sequence’s size.” You can then use the operations you have just defined to create still more operations, each layered on top of the ones that came before. It’s a lot like creating life by assembling atoms to form proteins, then combining proteins to build cells, then combining cells to form organs, which ultimately combine to create a dog or a cat.
Defining new operations and combining them to do useful things is the heart and soul of programming. It is also a tremendously powerful way to think about other kinds of problems. According to , computational thinking is about the following:
Conceptualizing, not programming. Computer science isn’t computer programming. Thinking like a computer scientist means more than being able to program a computer; it requires thinking at multiple levels of abstraction.
A way that humans, not computers, think. Computational thinking is a way humans solve problems; it isn’t trying to get humans to think like computers. Computers are dull and boring; humans are clever and imaginative. Humans make computers exciting. Equipped with computing devices, they use their ingenuity to tackle problems that you wouldn’t have dared take on before the age of computing and build systems with functionality limited only by your imagination.
For everyone, everywhere. Computational thinking will be a reality when it becomes so integral to human endeavors that it disappears as an explicit philosophy.
We hope that by the time you have finished reading this book, you will see the world in a slightly different way.