3 The general purpose, programmable computer
The list of instructions the computer follows to process input and produce output is called a computer program. Computers are programmable.
For example, a QR code reader on a mobile phone app sends the name of a scanned bar-coded product and product details to the phone. The app has been programmed with a set of instructions that makes it:
- take in data via the QR-code scanner
- use the data from the QR-code scanner to look up the name of the product in a list that cross references QR-code data to product name
- generate a new form of data that is compatible with showing the product name and image on the display.
What is meant by the term programmable? You can think of a program as a set of instructions, such as:
- add two numbers
- then divide the result by three.
The result will vary depending on which two numbers are inputted into the program, which is useful. For example, if you input the numbers 5 and 7, then the result given by the program is 4; if you input 15 and 6, then the output is 7.
More significantly, you can change the set of instructions to do something different, such as:
- subtract one value from the other
- then multiply the result by four.
This implies a level of versatility, since you can change the set of instructions (the program) in order to produce different results. It’s this ability to change the instructions that makes a machine programmable.