Learning to love computer codes

Paint can The MacPaint source code is 5,822 lines long

You could do worse than spend the summer learning to program, argues Bill Thompson

I've just finished reading one of the most important pieces of writing from the last 30 years. It is carefully constructed, elegantly expressed and one of the most functional pieces of literature I've ever encountered.

Admittedly the characterisation is poor, largely because there are no characters, and what plot development there is created entirely by the reader.

That's because the writing is a computer program, written in the Pascal language, so it consists of a series of declarations and definitions of variables, constants, procedures and functions, along with the functional code needed to carry out instructions in the right order.

It is the source code for MacPaint, and I'm able to read it because Apple has donated it to the Computer History Museum and it is now available to download.

MacPaint starts like this:

Learning to program

It's easy to write software as you only need a text editor.

However Windows PCs don't come with programming tools by default, unlike the old BBC Microcomputer which expected its users to type in BASIC commands from the start.

You can code on a Mac by using the Terminal application (in Utilities) but you'll need some extras too.

One good option is Scratch, a programming environment created at MIT specifically to introduce the principles of programming.

If you feel a bit more adventurous you can buy an ARM mbed micro-processor controller and use the online programming tools provided with it to control other hardware too, and even make robots.


{ BitMap Painting Program by Bill Atkinson }

and includes lines like:

TYPE Str63 = String[63];


EntryPtr = ^QueueEntry; { for mask stuff }

QueueEntry = RECORD

addr: LongInt;

bump: INTEGER; { +2 or -2 for right or left }

twoH: INTEGER; { 2 times horiz word coord }

mask: INTEGER;


It may not be everybody's beach reading, but it has been wonderful to see how it works.

It was written by Bill Atkinson and shipped with the original Macintosh computer in 1984, and makes extensive use of the QuickDraw screen display package, which is also available to download.

MacPaint became the defining Mac program because it allowed anyone to draw and sketch on a screen for the first time.

Paint prose

There had been other drawing programs before, of course, beginning in 1963 when Ivan Sutherland created Sketchpad, and MacPaint itself was based on LisaSketch - also called SketchPad - which Atkinson developed for the earlier Apple Lisa computer.

But MacPaint came bundled with the Mac and was available to ordinary users rather than the computer scientists who had access to the early systems. It made its way into offices and classrooms and homes, and shifted the boundaries of what you could do with a computer.

Start Quote

Bill Thompson

those who do not appreciate how the technologies that define their world work are in danger of being controlled by them”

End Quote Bill Thompson

I was one of those early users, as the small software company I worked for in Cambridge in 1984 acquired a Mac to 'test drive' as soon as they became available in the UK, and I later showed it to an artist friend of mine, Bryna Waldman.

She had never held a mouse before, and as far as I know had never in fact used a computer.

I watched as she drew a carefully composed sunset - in grey-scale, of course, as the early Mac had a monochrome screen - and realised that the world had changed.

The revolution that MacPaint began has been astonishingly successful, and we are now surrounded by computers with touch-based graphical interfaces of startling sophistication and rare beauty.

However very few of us understand what lies behind the tools we use, or appreciate how even the most computer user interface is derived from lines of code like:

PROCEDURE CursorNormal;


InitCursor; { arrow, not hidden }

GridMouse(-1,-1,0,0); { no grid }


This needs to change, because those who do not appreciate how the technologies that define their world work are in danger of being controlled by them.

children on computers School children should also be encouraged to learn about the foundations of programming

My partner's daughter is currently learning Latin because she is fascinated by the ancient civilisations of Greece and Rome and realises that unless she understands the language used at the time she will always be forced to see their world through the filter of another person's understanding, because everything she reads will be in translation.

If she knows the language herself then she will at least have removed one of the layers between her and Suetonius.

I believe that the same is true of programming, and that anyone using computer technology should have at least a basic understanding of what software looks like and how the lines of code in Pascal or BASIC or C control the operation of your laptop, mobile phone or pacemaker.

We live in a world increasingly defined by the code that runs on the billions of processors that surround us.

ICT lessons in schools concentrate solely on how to use applications and services and not on the underlying principles of computer science, so a whole generation is growing up with no real understanding of the technology that defines our age.

So if you've got a free moment this summer, perhaps you should pick up a code listing instead of the latest Dan Brown.

Bill Thompson is an independent journalist and regular commentator on the BBC World Service programme Digital Planet. He is currently working with the BBC on its archive project.

More on This Story

bill board

The BBC is not responsible for the content of external Internet sites

More Technology stories


Features & Analysis

Elsewhere on the BBC

  • ClockMore for less?

    Could spending less time in the office make you perform more efficiently?


  • A woman sits on a bed in a scene from Gustav Deutsch's latest film about Edward Hopper's paintingsTalking Movies Watch

    How film-maker Gustav Deutsch brought Edward Hopper’s paintings to life

BBC © 2014 The BBC is not responsible for the content of external sites. Read more.

This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.