Computers are ubiquitous in modern life. They offer us portals to information and entertainment, and they handle the complex tasks needed to keep many facets of modern society running smoothly. Chances are, there is not a single person in Ars’ readership whose day-to-day existence doesn’t rely on computers in one manner or another. Despite this, very few people know how computers actually do the things that they do. How does one go from what is really nothing more than a collection—a very large collection, mind you—of switches to the things we see powering the modern world?

We’ve arranged a civilization in which most crucial elements profoundly depend on science and technology. We have also arranged things so that almost no one understands science and technology. This is a prescription for disaster. We might get away with it for a while, but sooner or later this combustible mixture of ignorance and power is going to blow up in our faces.

—Carl Sagan

At their base, even though they run much of the world, computers are one thing: stupid. A computer knows nothing. Its brain is little more than a large collection of on/off switches. The fact that you can play video games, browse the Internet, and pump gas at a gas station is thanks to the programs the computers have been given by a human. In this article, we’ll take a look at some of the basic concepts of computer programming: how a person teaches a computer something and how the ideas encapsulated in the program go from something we can understand to something a computer understands.

First, it needs to be said that programming is not some black art, something arcane that only the learned few may ever attempt. It is a method of communication whereby a person tells a computer what, exactly, they want it to do. Computers are picky and stupid, but they will indeed do exactly as they are told. Therefore, each program you write should be like an elegant recipe that anyone—including a computer—can follow. Ideally, each step in a program should be clearly described and, if it is complicated, broken down into smaller steps to remove all doubt about what is to happen.

Read 65 remaining paragraphs | Comments

via Ars Technica » Technology Lab http://feeds.arstechnica.com/~r/arstechnica/technology-lab/~3/hcgy_xaD0jQ/

Advertisements