Sunday, January 01, 2012

The JavaScript Turtle

The state of computing and IT education in the nation's schools was a subject which came up several times at the couple of developers' conferences I attended this summer. At Update Conf, Anna Debenham's talk The Digital Native was a survey of current practices in teaching IT. I can't say I was particularly surprised that things haven't moved on much in the 20-or-so years since I was at secondary school. The roomful of Archimedes have been replaced with Windows PCs, but otherwise the curriculum, with its emphasis on doing pointless things in the name of learning to use a few productivity applications, seems the same.

(Anna's talk was probably the most thought-provoking of those given at Update, if only because its unevenness meant it wasn't as polarising as those by certain other speakers. There was a lot there which I agreed with, along with too much I found ill-informed and irritating for whatever reasons. All of which is, I guess, the mark of an excellent conference speaker.)

The basic preoccupation for attendees — a good number of whom were developers, even though Update itself had a far broader mix of professions represented — was whether the teaching of IT in schools should include programming. Later that week, at iOS Dev UK in Aberystwyth, Fraser Spears, during the Q&A portion of his talk on the deployment of iPads to school kids he's been overseeing, was asked this specific question. His reply — which I find myself wholeheartedly agreeing with — was that general IT education should engender an interest in computing such that a child may be inspired to take up programming, but programming itself should only be an optional part of the curriculum.

My agreement is probably due to the fact that I came to programming on my own, without ever meeting it at school. There was a myth among my year — which may have been true, I have no real way of checking — that up until only a couple of years previously, programming had been generally taught, and that we had only just missed out. I don't know what affect being taught programming would have had on me. Maybe it would have crushed any enthusiasm I felt for the subject. Apart from at A-Level, I have no academic programming experience, but I like to think that, more important that teaching myself how to program, was teaching myself how to teach myself to program.

Anyway, all of this talk of education got me to thinking about those old stalwarts of teaching kids about computers: Logo and the turtle. I can't remember for sure whether I ever met these two (I have vague memories of a BBC Micro and a primary school classroom, but I may be inventing those...), but I've never really got on with Lisp. Whatever its educational benefits, its hardly a mainstream language these days, and if we're going to introduce school children to programming it may as well be in a language they can conceivably take forward into a career. So without further ado, I present the JavaScript Turtle.

The JavaScript Turtle is my first attempt at implementing a turtle in javascript (hence the deceptive name). As will become apparent by examining the source, I'm really not a web guy. Nevertheless, I have a soft spot for javascript, and I think that web technologies are an ideal playground for introducing the next generation of hackers to the wonders of code. The more perceptive among you will realise that what we're giving the young user here is a environment which allows them to execute arbitrary javascript — not just turtle control code — within the page. It's a massive, but basically safe, new world for the more inquisitive to explore.

My intention was to have the whole thing — markup, styles and code — encapsulated in a single file, so even if your school network is locked down, you can still distribute it the old fashioned way (which in my mind means floppies, although I've no idea if even our decrepid UK schools still support them). I intend to continue working at this — in particular, I need to add the ability to parse and handle control statements in a smart way — so if this is of any use to anyone, let me know.

No comments: