The Royal Society, Britain's science academy, is curious as to why British youngsters seem to be going off studying computing at school. The number of people studying the subject has fallen by a third over the past four years, which is odd, considering how much boilerplate we get from the great and the good about the importance of computer literacy in today's wired world.

The RS is getting together with teaching outfits and the Royal Academy of Engineering. They intend to investigate the problem and produce a report. As is compulsory for anything to do with science in modern, cash-strapped Britain, the RS worries dutifully that having fewer kids studying computing will damage Britain's economy. Maybe. But I want to defend computing not because a good computing curriculum might raise GDP by a few percentages points, but because the subject deserves on its own merits to be part of any modern, liberal education.

Full disclosure: your correspondent is a huge computer nerd, and has been ever since he was in short trousers. I'm familiar with the problem the RS describes: when I was at secondary school over a decade ago, our computing classes were terribly dull. In fact, they weren't really about computing at all. They were about the quirks of Word, how to make pretty charts in Excel and the importance of backing up your files, the sorts of things taught on computers-for-the-clueless courses like the European Computer Driving Licence. In fact, the analogy with a driving licence illustrates the point nicely: for me, the classes were rather like going on an automotive engineering course, only to find it was all about how to perform hill starts and three-point turns. From talking to today's teenagers, it seems little has changed.

Yet for anyone raised around computers (in other words anyone born during the last twenty years), this kind of thing is condescendingly obvious and not very interesting: once you know your way around a PC, you can usually figure out how a particular software package works with a bit of trial and error. Nor is it useful any longer to employers, who can reasonably assume that anyone under the age of 40 is as familiar with computers as they are with, say, televisions or radio sets.

These sorts of worries, I presume, inform the RS's speculation that perhaps computing is not an academic subject suitable for teaching in schools. But for all the problems with teaching the subject, that's going too far. Computing can be very abstract - ultimately it is a branch of mathematics - and the theoretical stuff is, if anything, probably too advanced to easily teach to 16-year-olds. But that doesn't mean it shouldn't be taught in schools. On the contrary, if it's taught well, computing - as opposed to learning about individual programs - is one of the most stimulating subjects out there.

I have much fonder memories from an earlier phase of my education. I remember one project at primary school where we wired up an old BBC Micro to a little model town, and used it to control traffic light sequences. That something as virtual and abstract as a cursor on a computer screen could cause changes in the real, physical world was a revelation. A few years later we were messing around with LOGO , an extremely simple programming language in which you issued commands to a little turtle that would move across the screen drawing lines as it went. If you want to get technical, Wikipedia describes the idea behind Logo as "a method of programming vector graphics using a relative cursor (the turtle) upon a Cartesian plane"

My short-trousered self didn't know a vector from a hole in the ground and had never heard of a Cartesian plane. But I was amazed by the fact that such a simple set of rules could be used to generate an amazing variety of sometimes quitebeautiful images. That, for me, sums up the seductive intellectual core of computers and computer programming: here is a magic black box. You can tell it to do whatever you want, within a certain set of rules, and it will do it; within the confines of the box you are more or less God, your powers limited only by your imagination. But the price of that power is strict discipline: you have to really know what you want, and you have to be able to express it clearly in a formal, structured way that leaves no room for the fuzzy thinking and ambiguity found everywhere else in life. The computer is an invaluably remorseless master: harsh, sometimes to the point of causing you to tear your hair out, but never unfair. If something you tried doesn't work, then you made a mistake (somewhere). The sense of freedom on offer - the ability to make the machine dance to any tune you care to play - is thrilling. And the discipline of expressing your throughts in remorseless, rigorous logic is wonderfu mental exercise.

The same sorts of sentiments (and usually better expressed) can be found in hacker memoirs, and from just talking to computer programmers, or at least to the ones who programme for love rather than money. They fill the pages of Steven Levy's excellent book Hackers, which despite its antiquarian subject matter (it starts with the MIT Model Railroad Club in the 1960s and finishes in 1994), is still an excellent introduction to the intellectual pleasures of messing about with computers. Nor is it just idle intellectual games: the combination of freedom and discipline offers an excellent way to teach children how to harness and direct their the powers of their minds. Like philosophy, computing qua computing is worth teaching less for the subject matter itself and more for the habits of mind that studying it encourages. The best way to encourage interest in computing in school is to ditch the vocational stuff that strangles the subject currently, give the kids a simple programming language, and then get out of the way and let them experiment. For some, at least, it could be the start of a life-long love affair.

(The LOGO illustration comes from Robert Nunnally on Flickr)