HTML5 & Javascript: The New ZX Spectrum (or … insert 8-bit machine of choice with BASIC interpreter)

Raspberry Pi

[DRAFT]

That is a Raspberry Pi. It’s awesome and it’s the brain child of very awesome minds. One of which is a child hood hero of mine, David Braben. Yes, that David Braben. The one who co-developed Elite. Yes, that Elite.

So that is a Raspberry Pi and it’s supposed to ignite a whole ‘new’ generation of kids who’ll pick it up for $25ish and learn to code. Only it wont.

Raspberry Pi won’t get kids coding

Just so you know, I don’t want that to be true, but I think it will be. Sadly, and I hope I’m wrong as there are a lot of smart, generous and wonderful people behind it, the only people who will be into it are people like me (and likely you). We’re coveting them, right now, because they are tiny and cute and it tugs wistfully at our nostlagia. (can you tug wistfully? and if you can, can you tug at nostalgia – Look, I think we both know you can’t, ignore that bit, just imagine it makes sense)

I hope I’m wrong on that but on the positive it will create an enormous buzz around the subject of Computer Science in and outside of education. That is a success in itself! This will be no mere moral victory as anything raising the profile and attraction of computing to current generations is a must. Software is our final frontier, a place where anything can be built and we need people who can build software, software to help at work, at play and importantly to help advance healthcare and science – how much of a DNA sequence can you hold in your memory?

So what’s this got to do with the ZX Spectrum and Javascript?

I’m glad you asked!

The reason a generation grew up unafraid to write code was due to those little 8-bit black, grey and beige boxes plugged into our TVs. Our parents bought them to “help with the homework” but they never saw a jot of homework (if yours did, you have my sympathies).

No, they were for more important things: playing games. And for most, you had to write a program to play a game, even if it was something as simple as: Load "". Let me repeat that, it’s simple but enlightening. To play a game you had to enter some BASIC into the machine. That’s a program. Might be trivial but it’s a start!

This was BASIC. It was built in. It was a service that was part of the box, like being able to add on a calculator, something we would take for granted. It was just there.

Some of us learned to use it to make the computer do things, usually as a result of boredom with a current game, such as: draw things on the screen, print infinite loops in Dixons telling everyone “Martin is Ace”, maybe even a game. Digression: this is a true story, I wrote a basic version of a Teletext on my spectrum and each morning would update the stories from newspapers so my gran could flip through the news in big print on the TV, I was about 11 when I did that. I’m now 38 and have been a professional software developer since 1996. I never had a fear of programming because I’d been doing it since I could remember. For me, code is just part of my language in general.

There’s a platform and language that has the same ubiquity as Micros and BASIC: it’s the Web and Javascript.

The web browser with its Javascript interpreter is the perfect modern equivalent to the 8Bit micro and BASIC. Many households will have at least one and some more than one. In my eyes, the web browser is now also the world’s largest game console. For me, Facebook and Zynga have started proving this.

As a language Javascript is perfect for teaching on, it’s interpreted, it has garbage collection and now with HTML5 and OpenGL a very simple, but powerful, way to draw.

It’s beyond the scope of this rambling but this is all you need todo to draw a line:

var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");

context.beginPath();
context.moveTo(100, 150);
context.lineTo(450, 50);
context.stroke();

The Spectrum’s BASIC had plot and draw which could be used liked this:


PLOT 0,100:
DRAW 80,-35

What makes it similar to the 8Bit generation (remember those listings in magazines for games) is that because it’s interpreted you can view Javascript in any website simply by viewing source! This is how we really learn, we find something we think is cool, copy and change it to see how it works. We learn by doing.

I’ll rewrite this so it’s more conscise but that’s the jist of my argument

All in all, I’d love to see Raspberry Pi in the hands all school kids but part of me thinks they’ll be playing with browsers and apps – and if we can keep them on HTML5, then we’ve got a chance to teach them some code.

Leave a Reply