Introduction

This website will introduce you to some of the most important ideas in computer programming in an interactive, visual way through a guided activity. The activity is about a language for describing pictures. You will use a computer program that lets you type a sentence in the language, and shows you the picture that it describes. At first, the pictures you will make will be simple combinations of stick figures: three men in a row, or one man supporting two smaller men. But gradually, the pictures will get more complicated, and soon we will be describing pictures like the one on the entry page of this website. That picture looks frighteningly complicated, but like all the pictures we will describe, it consists of a few basic tiles combined according to some rules.

The point of this activity is not that the language of pictures is useful in itself (although it has important uses in describing the 'pictures' that go into making integrated circuits), but that complex pictures are a metaphor for the complex behaviours that are shown by computer programs. For example, a word processor takes simple actions like printing an individual letter or digit, and combines them into the immensely complex activity of printing an entire document, with each letter and digit in its right place. A spreadsheet takes the simple actions of adding or subtracting or multiplying two numbers, and combines these actions in complex ways to carry out elaborate calculations. The aim of this activity is to let you understand something of what it is like to write a computer program, why it is that computer programming is difficult, and (we hope) why computer programming is a fascinating activity that can be totally absorbing.

To succeed in this activity, you will need to be prepared to think very carefully about what will happen when you write different expressions in our language of pictures. After a while, we will reach sentences that are sufficiently complicated that you will not be able to predict in complete detail what the computer will draw. Part of the point of this activity is that, although the rules for interpreting sentences in the language are simple and known, the effect of applying them systematically can be difficult to imagine. Because you will be using a computer, when we ask you to think about what picture will appear, it will be very easy just to type in the sentence, press the button and see. That's all very well, but you will get a lot more out of the activity if you can explain to yourself why the computer draws the pictures it does.

Computers are very literal creatures, and you will soon discover that, unless you type in each expression exactly as you see it written on the worksheet, the computer will very likely complain that it does not understand what you mean, usually by giving a rather cryptic "error message". Any little mistake, such as a spelling error or a missing bracket, will prevent the computer from doing what you want. This is just a fact of life when using computers; people have tried to make computer programs that can correct small errors, but (like the spelling checkers that come with word processors) the 'corrections' are often even less correct than the original mistakes, so that idea is usually more trouble than it is worth. At first, it seems humiliating that the computer is always complaining about 'errors' in your work, but computer programmers soon become used to just correcting the mistake and trying again.

Don't be afraid of trying different expressions to see what the computer will do. The worst thing that can happen is that the computer will not be able to make sense of what you type, and you will get another of those "error messages". Or perhaps the computer will draw a picture that is not quite the one you had in mind; in that case, you should try to understand why the picture looks as it does, then try again with a different expression. Just occasionally, the picture that appears will not be the one you wanted, but will be interesting in an unexpected way: that's one of the delights of working with computer graphics.