What is programming?
- 10/4/2016
- What makes a programmer?
- Computers as data processors
- Data and information
- What you have learned
What you have learned
In this chapter you’ve learned a bit about how computers actually work and what programming is about. You have discovered that a computer views the entire universe as patterns of ons and offs (1s and 0s), which represent the data the computer is working with. The computer performs data processing by transforming one pattern of bits—the input—into another pattern of bits—the output.
When human beings take a look at the data output and act on it, the data becomes information. Computers are unaware of the meaning that we place on the patterns of bits that they process, which means that a computer will do things with data that make no sense.
A program tells the computer what to do with the pattern of bits. The computer itself understands only very simple instructions, but programs called compilers can take in a higher-level description of the actions that are required and produce the simple instructions for the computer to perform.
The job of the programmer is to create a program as a sequence of instructions that describes the tasks to be performed. To solve a problem successfully, the programmer must not only write a good program but also make sure that the program actually does what the user wants. This means that before a programmer can write any code, she will have to make sure that she has a good understanding of exactly what is required. Talking to people and finding out what they want is a very valuable skill and worth acquiring if you want to be a successful programmer.
To reinforce your understanding of the content, you might want to consider the following questions about computers, programs, and programming.
Would a computer “know” that it is nonsensical for someone to have an age –20?
No. As far as the computer is concerned, the age value is just a pattern of bits that represents a number. If we want a computer to reject ages that are negative, we have to actually build that understanding into the program ourselves.
If the output from a program is the settings for the fuel-injection system on a car, is the output data or information?
As soon as something starts acting on data, I think it becomes information. A human being is not doing anything with these values, but they will cause the speed of the engine to change, which might well affect humans, so I reckon this makes this information rather than data.
Is the computer unintelligent because it can’t understand English?
It is very hard to write something in English that is completely unambiguous. Large parts of the legal profession are built on precise interpretation of the meaning of texts and how they are applied in particular situations. Since we humans can’t agree on how to understand something, I don’t think it is fair to call a computer stupid because it can’t do this either.
If I don’t know how to work out the answer, can I write a program to do it?
No. You can put some statements together and see what happens when they run, but this is very unlikely to make what you want. It is rather like throwing a bunch of wheels, gears, and an engine against a wall and expecting them to land and form a working car. In fact, the best way to write a program is frequently to get away from the keyboard for a while and just think about what the program is supposed to do.
Is it sensible to assume that the customer measures everything in inches?
It is never sensible to assume anything about a project. A successful programmer needs to make sure that everything he is doing is built on a solid understanding. Every assumption that you make increases the potential for disaster.
If the program does the wrong thing, is it my fault or the customer’s fault?
It depends:
Specification right, program wrong: programmer’s fault
Specification wrong, program right: customer’s fault
Specification wrong, program wrong: everyone’s fault