Home > Sample chapters

What is programming?

Data and information

Now that you understand computers as machines that process data and that programs tell computers what to do with the data, let’s delve a little bit deeper into the nature of data and information. People use the words data and information interchangeably, but I think it’s important to make a distinction between the two because the way that computers and humans consider data is completely different. Take a look at Figure 2-7.

Figure 2-7

Figure 2-7 Data on the left; information on the right.

The two items in the figure contain exactly the same data, except that the image on the left is closer to how the document would be stored in a computer. The computer uses a numeric value to represent each letter and space in the text. If you work through the values, you can figure out what each of them are, starting with the value 87, which represents an uppercase W.

Because of the way that computers hold data, another layer sits underneath the mapping of numbers to letters. Each number is held by the computer as a unique pattern of on and off signals, or 1s and 0s. In the realm of computing, each 1 or 0 is known as a bit. (For a wonderful explanation of how computers operate at this level and of how these workings form the basis for all coding, see Charles Petzold’s Code: The Hidden Language of Computer Hardware and Software.) The value 87, which we know means “uppercase W,” is held as the following bit pattern:

1010111

I don’t really have the space to go into precisely how this works (and Charles Petzold already did this!), but you can think of this bit pattern as meaning “87 is made up of a 1 plus a 2 plus a 4 plus a 16 plus a 64.”

Each of the bits in the pattern tells the computer hardware whether a particular power of two is present. Don’t worry too much if you don’t fully understand this, but do remember that as far as the computer is concerned, data is a collection of 1s and 0s that computers store and manipulate. That’s data.

Information, on the other hand, is the interpretation of data by people to mean something. Strictly speaking, computers process data and humans work on information. As an example, the computer could hold the following bit pattern somewhere in memory:

11111111 11111111 11111111 00000000

You could regard this as meaning “You are $256 overdrawn at the bank” or “You are 256 feet below the surface of the ground” or “Eight of the thirty-two light switches are off.” The transition from data to information is usually made when a human reads the output.

So why am I being so pedantic? Because it is vital to remember that a computer does not “know” what the data it is processing actually means. As far as the computer is concerned, data is just patterns of bits; it is the user who gives meaning to these patterns. Remember this when you get a bank statement that says that you have $8,388,608 in your account!