Skip to story
ELI5 Yahaaa

Instructions, and nothing but

What Is a Computer Program?

A program is a list of instructions so precise that something with no understanding at all can follow them.

1 A list of exactinstructions2 The computerfollows them inorder3 Somethinghappens onscreen
No understanding required at either end.
  1. Step 1 of 5

    The computer understands nothing.

    A person Fills in what you meantA computer Does exactly what youwrote

    It cannot guess what you meant, notice that a step is silly, or skip an obvious mistake. It does exactly what it is told, in order, which is why programs are so fussy to write.

  2. Step 2 of 5

    Three ideas cover almost everything.

    In order: do this, thenthatA test: if this, dothat insteadA repeat: keep goinguntil doneAnd that is very nearlyall of it

    Do this, then that. If something is true, do this instead. Keep doing this until something changes. Nearly every program ever written is those three, nested inside each other.

  3. Step 3 of 5

    A repeat is where the power is.

    Ten names by handa couple ofminutesTen thousand by handdays of workTen million by loopthe same threelines

    A person writing out ten thousand names would take a week. A loop does it in a moment, and the instruction to do so is three lines long whether it is ten names or ten million.

  4. Step 4 of 5

    Bugs are usually correct instructions for the wrong thing.

    1 The instructionis followedperfectly2 But it was thewronginstruction3 Something oddappears onscreen

    The computer did precisely what it was told; the trouble is what it was told. That is why programmers spend more time reading and testing than typing.

  5. Step 5 of 5

    Underneath, it is all switches.

    The program a personwrote Millions of switchesflipping on and off

    The words a person writes are translated down into millions of tiny on-or-off switches flipping. Every program, however clever, ends up as switches — just an enormous number of them.

    The first program is generally credited to Ada Lovelace, written for a machine that was never actually built.

The short version

A program is exact instructions run in order, with tests and repeats — and the computer follows them without understanding any of it.

Try it yourself

Write instructions for making toast, then have someone follow them literally and stupidly. The gaps you find are bugs.

Topics