Raspberry Pi - will it get our children programming? and if so why not in Perl?

I'm sat in my study writing this on my new Raspberry Pi - how cool is that? It arrived yesterday from Farnell from whom I preordered it nearly 6 months ago. Bare with me as I'll get to the Raspberry Pi and Perl but first some observations on what got me into programming.

What got me into programming
So what has all this got to do with the Raspberry Pi?
Some Raspberry Pi observations
Is Perl taking advantage of the Raspberry Pi?
In Conclusion

What got me into programming

The Raspberry Pi kind of reminds me of the Sinclair ZX81. Not that it looks anything like it but it is a) cheap b) innovative and c) might get our children programming (apparently). Step back to my childhood and the first computer I saw was a RMZ the physics teacher had although I never got to use it. Then there was a Commodore Pet in one of the science labs and the politics teacher got a ZX81 at some stage. However, in a school of 800 pupils your chance of using any of these was worse than slim. A friend's father had a TRS80 (and later owned a Dragon) but he didn't seem to do much on it other than play some games. Of course, everyone seems to credit the BBC Micro from Acorn and the wonderful BBC series based on it with inspiring a generation of programmers but for me it was the Sinclair ZX Spectrum.

After glimpsing the possibilities of computers, when Clive Sinclair announced the Spectrum I just had to have one. I think I nagged my dad constantly for weeks or months and eventually we struck a deal (although my memory on this is a little hazy I'm sure my dad will put me right). If I saved up half he'd put the other half in (that was not the first deal of this kind so I could be totally wrong and he paid for all of it). It was around £175 (for the 48K version which was a lot) and after ordering (preordering?) it I had to wait ages for it.

So what did you get with the a Spectrum? You got small Z80 based computer, a power supply, a horrible keyboard where each key had about 3 or 4 different functons, a video cable, Sinclair Basic and a mic/speaker connection to attach to a cassette recorder. There were 16K and 48K versions (I luckily had the latter) and you had to attach it to a television. That's right, 16K or 48K! Sounds ridiculous now.

I used to use it with a small portable black and white television for ages. The screen only displayed 32 characters per line (256 pixels across), I think you could have 2 colours per character and Sinclair Basic was pretty basic (pardon the pun). However, in my opinion it was the fact that it was so basic that made me dig deeper. I learnt Basic from the manual and started writing programs and the more I wrote the more I wanted to write them. But Basic was so limited and the games that started to come out (Manic Miner, Ants etc) seemed to do things that were impossible in Basic and of course they did, because they were written in Z80 machine code.

So I bought an assembler from HiSoft Software and taught myself assembler. I learnt quite a lot (and made quite a few friends) hacking into games. I wanted more characters per line so devised my own characters that fitted into 6 pixels instead of 8 (and later 5) to get 42 and 51 characters per line. Then using the defined functions in Basic I interfaced it to a ton of Z80 which created menus with lines drawn around them and separators which allowed someone to pick an item and return it back to Basic. Later the microdrive came out and I bought a book with a full disassembly of the Interface 1 ROM and worked out who to tweak it to get more space on the microdrive by shortening some of the timings. I even sold this software from a stall at Sinclair shows and used some of the money to buy a Disciple Interface and a real 5.25" disk drive.

Having an interest in electronics I even made an EPROM programmer and rewrote the Sinclair and Interface 1 ROMs with changes I'd made and I still remember the nervous moments attempting to desolder the existing ROM chips and solder in new sockets so I could change the ROMs. I still have all stuff in my loft now!

So what has all this got to do with the Raspberry Pi?

OK, so your now saying to yourself what has this got to do with the Raspberry Pi. Well quite a lot because the Raspberry Pi has been developed to encourage children to program and as I'm not a teacher I only have my own experiences as a child to look at. The Spectrum made me dig deeper and learn Z80 because I couldn't do the things I wanted to do in Basic. Also, because writing Basic on the Spectrum took a long time (and assembler even longer) it taught me to be a lot more careful. It is like 2 habits I still have today that were learnt from years ago. I repeatedly save anything I'm writing in case I lose it (although the chances these days are slim and I use journaling and multiple versions in my editor anyway); a lesson learnt from the past with systems regularly crashing and hopefully someone shouting "save your edits" before it was too late. I am careful what I write because of my experience early on in a VMS software house where we only had one C compiler license so all compilations had to be submitted to a batch queue and you might have to wait 2 or 3 hours for the job to finish. When you'd waited all that time you tried desparately to get the code right first time (I notice younger programmers repeatedly compiling or running -cw on their code which of course you can do now almost instantly).

The Raspberry Pi has some of the feeling of those days; it is pretty raw, it is fairly slow (compared with my PC that is), its cheap and easily reimaged (in those early computers the OS was in ROM so difficult to permanently break) and even during the writing of this blog entry (which I was doing via a web form initially) it went wrong (and I would have lost my work had I not just copied it to a file previously) but it also has everything else you expect from a Linux desktop these days. It has an office suite and IDEs for development, it can play MP3s and you could watch a movie on it or edit your facebook page, or send/receive emails, watch youtube etc. All of this is a distraction having nothing to do with programming; you get so much why would anyone learn to program?

So, may be that is a little harsh and someone is going to say it won't interest children if they can't do all that stuff but in today's world with high spec and exciting video games, facebook, mobile phones how are we going to drag children away from them and learn programming. In my opinion the trick is letting them see they can control something. Now, this may be where the Raspberry Pi will succeed BUT I don't think it does it out the box. I have an Arduino and have used it for various things like monitoring my electricty and water usage or the temperature in our machine room - all useful but where we'll grab children's attention is writing some code which actually controls things (this is what scratch does), but making something physical happen, move something for instance. A bit like the turtle that used to exist and the Logo language used to control it. I also remember at University using C and AMX? to control a small box of electronics in real time to blink LEDs and turn motors, switch relays etc.

A colleague of mine with 2 children said they are mostly taught how to use existing software and not write any. However, just recently he showed me scratch (and I think Gabor Szabo mentioned it briefly in a talk at YAPC::NA 2012) and it seems an interesting and engaging way of getting children programming. The engaging bit is a child writes code (ok, there is a lot of dragging and dropping in this but its close) which controls a character, its got collision detection and a whole host of other controls. Now, take this and add something physical to it like turn a motor, or control a robot and I think you've got something even more engaging.

So the Raspberry Pi is great on cost and has the potential to add the ability to control physical things but it cannot do it without adding extra kit. If someone can add to the Raspberry Pi a cheap bit of electronics which allows children to see real things happen I think it has got it made. I've read a little about the Gertboard but I don't see it for sale anywhere. JeeLabs sell some fairly cheap i2c boards which look like you could connect to the GPIO pins with jumpers.

Some Raspberry Pi observations

Not having a VGA output is in my opinion also a mistake. That would be like the ZX Spectrum only working on colour televisions in an age where most house holds only had one televison anyway and perhaps a small black and white portable (like we had). Even in my house (and I have loads of electronics) my LCD monitor only has VGA so I was forced to connect the Raspberry Pi to my main television.

Then there is availability. I wonder just how many educational establishments or teachers managed to preorder the Raspberry Pi and have one (or more) now. I saw the Raspberry Pi news last year, thought it was interesting and at £25 preordered one around 6 months ago. I'm willing to bet there are quite a few people like me and so is the Raspberry Pi really getting to the people it was designed for?

Now I know why the Raspberry Pi is as it is - to keep the cost down, but without being boxed it is an accident waiting to happen. By the time I had an HDMI cable (which is thick and not that flexible), an rj45, a power connector, a mouse and a keyboard plugged in I had to put something heavy on top to stop it being dragged off my desk. Would a case have added so much to the cost. I'm fairly sure I bought a case for my Arduino for £3-4 (I see The Pi House but at £13.25 is seems pricey compared with the Raspberry Pi itself and other cases on ebay all seem to be over £10 too, some over £20 although there are plenty for under £10 at the Etsy store). Will children understand that poking the circuit board with their pens is quite possibly going to break it? Then, because of the size (and perhaps cost) the connectors/sockets look easily broken to me.

Is Perl taking advantage of the Raspberry Pi?

For some reason, most of the pages I've read with regard to programming and the Raspberry Pi seem to mention Python. I'm unsure why Python is promoted so much on the various Raspberry Pi web sites and why the Python forum has twice as many topics as the other languages put together.

In the "other languages" forum there is only really one thread on Perl.

The debian squeeze distribution I loaded onto the SD card contained Perl 5.10.1 and Python 2.6.2.
UPDATE: I switched to Debian wheezy and got Perl 5.14.2.

Can we use the Raspberry Pi to promote Perl to youngsters; should we? Is it worth writing some easy startup for youngsters embarking on programming Perl on the Raspberry Pi? As a community we seem pretty good at helping each other out but most of us are programming professionally. Wouldn't it be worth getting in at the ground level. What might persuade someone young to try Perl first?

Is Perl even a good choice for learning programming? I don't see why not but then I'm not a teacher. It didn't seem to make much difference to me that I started with Spectrum Basic then learnt Z80 and some 6502. Since then I've used assembler for various chipsets, Fortran, Pascal, C, C++, Java, Perl, PHP and even a little Python and Ruby. Getting children started seems more important than which language it is but I think with the CPAN, you can do an aweful lot in a relatively small amount of code in Perl so it is a good a choice as any other.

I did a quick search for Perl and children and found a few links (it's not that easy given the string "children" is often used in reference to forking):

Teaching Perl to Children
Tinkering with Perl
How to teach Perl to children

[Boston.pm] teaching kids Perl

Why SDL Perl Matters

BTW, I tried to install Perl DBI (which does not have many dependencies) with cpanp and after 13 minutes it died with the signal 'Killed' - hmm. I've not investigated further yet - but I had plenty of disk space left on a 4gb card.
UPDATE: It appears I had some problems with my sd card - switched to another one and the machine seems faster but cpanp still bombs out as before - trying cpanminus.
UPDATE2: ilmari suggested cpanp might be a big memory user so I installed cpanm and managed to install DBI - although the test suite took over 60 minutes to run.

In Conclusion

So, it might sound like I'm a little negative about the Raspberry Pi. Well may be. On the plus side it is cheap and does a lot for the money and a child can take ownership of it which some say makes all the difference. Will it get into schools and make a difference, I'm not sure but I found Kids and their Raspberry Pis and thought it encouraging. I certainly hope it does and I hope some choose Perl.

Comments

raspberryperl.org

Not sure who I talked with at YAPCNA2012 about this (it's a blur,in a good way) but providing ISO(s) that allow kids to get started right away programming perl on the Pi was discussed. One for games devel (Scratch perhaps), one focused on making bootable thumbdrives for more embedded kind of projects, running Padre out of the box with big shiny icons on the desktop. I registered raspberryperl.org to make sure it was available to the community, should a project form. Suggestions on what to put there, or possibly who to transfer it to, are welcome! Don't expect my RPi to show up for several months, alas. :)

It's so different today

We had quite a similar start at about the same time though I have not gone so deep and never touched the hardware part. My father did not make such deals either. Back in Hungary I would have not been able to save even fractions of that money anyway. OTOH I did a similar deal with my son :) Watching my kids and a bit other kids, I doubt going back to something simple will be interesting for them. I think it might be more likely to get kids programming if YouTube or the games had a programming interface. Not just for fatching data, but something that would change the movies themselves. I have been showing Scratch to my Perl trainig classes, people always like it but I am not sure if any of them is trying to show it to their kids. OTOH just before YAPC::NA I visited a high-school friend who moved to the USA and his 10-year old kid made huge and very interesting games using Scratch. So there is hope :)