Getting kids into programming (and what the Raspberry Pi is lacking) (by )

Back when I were a lad, if you bought a computer, you'd bring it home and plug it into the telly and turn it on and a BASIC prompt would appear.

Tough luck if you wanted to do practical tasks like word processing, but you could type a single command (such as CIRCLE 100,100,50) and be instantly treated to a circle appearing on the screen. Before long, my generation were writing programs to crunch numbers for our statistics homework, and lots and lots of games. And thus a generation of software engineers was born.

Getting started in programming is trickier for the contemporary twenty-first-century child; they have to install a software development environment (their computer probably didn't come with one), and then go through a wizard to Create New Project, write initialisation code to open a window, then write a redraw event handler that takes a graphics context and draws a circle with it. A little less approachable than "CIRCLE 100,100,50". At least you get a simple word processor and a Web browser out of the box, though... I'm no nostalgic Luddite :-)

Now, the Raspberry Pi has been widely hailed as the answer to our woes; costing just twenty pounds and usable given access to a TV and a dirt cheap USB keyboard and SD card, it's cheap enough to be purchased and given to a child to play with, unlike Mummy's laptop. Also, it has a user I/O port, meaning it should be relatively easily to integrate with home-built robots and other such fun electronics projects.

However, that's just the hardware side. What's seriously lacking is the software. If you buy a Pi and install one of the available Linux images onto an SD card and boot it up, you'll be presented with a Linux desktop environment. You'll be able to get to a shell prompt with little effort, and start learning shell, or get into a Python prompt and start to write Hello World, but that's not incredibly inviting; the effort required to do anything interesting from there is quite high. In particular, getting graphics going is hardly a job for a beginner.

So, I set out to improve on this situation. I've written a turtle graphics engine on top of Chicken Scheme, called Simple Graphics. Installing it is often painful as you need to get all the required bits of SDL and Cairo installed, but once that's done, thanks to Chicken's excellent egg system, installing simple-graphics is easy. And once you've done so, it's just a matter of:

(use simple-graphics)
(forward 10)

...to get started with drawing things on the screen.

However, that initial installation pain can be bypassed by making a Raspberry Pi image, based on the existing excellent work on basic Linux distributions for the Pi, that has Chicken and simple-graphics pre-installed, with a desktop icon to fire up a Chicken prompt with the simple-graphics library already loaded so you don't need the use line. But then I'd also like to add Chicken eggs to drive the I/O port on the Pi, including I2C and SPI. And sound generation, so you can make noises to go with your graphics while driving a real robot turtle through the I/O port...

It would also be good to have a version that boots straight into a full-screen Chicken prompt (which, if you start doing turtle graphics commands, splits into two, a graphics area that can be hidden/revealed/made full screen with hot keys, and the command-line area), for people using small screens.

That way, kids of all ages could immediately have an interactive environment that lets them program the full range of capabilities of the Pi. And being based on Scheme, it wouldn't be a "dumbed down" environment they'll grow out of and have to learn a new language in order to do more powerful things; they'll be able to use all the Chicken Eggs available, as well as being able to write their own code in a language eminently capable of the full range of programming tasks - yet still simple enough for anybody to get started with. Sure, I could have based Simple Graphics on Python or Ruby; but anything they can do, Scheme can do better.

12 Comments

  • By Jeff Adams, Thu 2nd Aug 2012 @ 10:48 am

    Might it not be possible to get the Pi to boot to a BASIC prompt?

    HP had a fabulous (ly expensive) computer in the 80's that could run Unix, or boot to a Pascal or Basic environment. It doesn't HAVE to run a full OS does it?

  • By alaric, Thu 2nd Aug 2012 @ 12:10 pm

    You could get the Pi to boot straight to BASIC, but we now have better programming languages than BASIC :-)

    But addressing the larger point: yes, it could boot straight to a prompt, and then even have a command you can run at the prompt that brings up a full conventional desktop session. However, unless you're doing particularly intensive programming, then the resources taken from your program by running a desktop environment behind it probably won't be a big deal, so you might as well have it around anyway (most people these days are familiar with windowing environments, so it's not even a great cognitive burden; and it lets them tinker with programming one window while another window has a Web page open with a tutorial in)

  • By Dave Wieneke, Thu 2nd Aug 2012 @ 9:24 pm

    Name any programming language that it better than BASIC and you'll find someone who can show you why it isn't. For its time BASIC was an easy language to use which required no knowledge of the “guts” of the computer from the programmer. Less than a year ago I was writing scripts in VBScript because it was quicker and easier to use than Java, .Net, or C

    For some godforsaken reason everyone thinks that the first language children should learn is "C". Better to dress your children in steel wool underwear than force them to understand that gibberish. Any programming language that uses punctuation to control the language was designed for the compiler-interpreter writer and not the programmer.

    Children should learn programming in a language that supports natural language, i.e.,

    "Add 1 to 3" ⇒ 4

    "The value of PI is 3.141592653 and the value of diameter is 10, so multiply the diameter times PI." ⇒ 31.41592653

    After they learn the concepts of programming, then they can be introduced to the neanderthal languages adults use to program.

  • By Tim McCormack, Thu 2nd Aug 2012 @ 11:18 pm

    Have you seen Racket's world.ss? It's a pretty great graphics package -- we used it in a Scheme-based programming intro course at Northeastern University.

    ...although turtle graphics has a certain appeal if you can motorize that Pi!

  • By Murray, Fri 3rd Aug 2012 @ 12:11 am

    I have given my pi a retro feel by using a 80's green monitor from an Sanyo MBC-555,from the inside both look like they have never been used(zero dust).

  • By Kale, Fri 3rd Aug 2012 @ 10:29 am

    BASIC? You're not serious right? BASIC is the single worst language any beginner should start with today. The problem with BASIC is that once beginners use it they never ever use anything else. They then proceed to call OOP a joke and close their minds forever, making very poor developers. Hell, i've even seen people who started with BASIC trying to create web pages etc. Just let it die! We have Python, Javascript and D, all very good first languages that would mutilate your brain from the beginning.

  • By Kale, Fri 3rd Aug 2012 @ 10:30 am

    wouldn't

  • By raydawg, Fri 3rd Aug 2012 @ 5:28 pm

    @Dave Wieneke - oh, you mean like... Cobol?

  • By Oflife, Fri 3rd Aug 2012 @ 6:50 pm

    This is very true. Accessibility is the key. If the barrier to entry is too high, then potential geeks and entrepreneurs of the future may in fact never get to experience that technical enlightenment that gave some of us a priceless headstart.

    I started on a Sinclair ZX-81 (still with me and functional!) that mixed the best of both worlds, the superb Sinclair Basic and the ability to use simple machine code instructions (Z-80) to get down and dirty with the CPU. Mix them both together, and you could write fairly good apps!

    I wrote a game that got me 100% in a College assignment. The thermal hard copy of the 'source code' is till with me in a box!

  • By Tim McCormack, Sun 5th Aug 2012 @ 7:38 pm

    Oflife: Thermal, like the stuff faxes use? Doesn't that degrade fairly quickly?

  • By Martian, Tue 7th Aug 2012 @ 12:43 pm

    @Dave You mean that BASIC - the crippled assembler? I agree C and Java were meant for sadistic teachers and masochistic pupils, but have you ever heard of languages like Python or Ruby?

    Also .Net is not a language as JVM is not Java! There are other languages then C#/Java running on the VMs. IronPython, Jython, JRuby, Clojure?

    However, my children will be taught a language from venerable Lisp family :-)

  • By elderK, Sun 17th Feb 2013 @ 1:25 pm

    I've been meaning to teach my girlfriend programming for around a year now and settled on giving her a couple small lessons with BASIC. As you mentioned in your post, it's very easy to get something nifty on screen, even when you've little to nil experience.

    And... that's very important. It lets people have fun right from the get go.

    Fun opens the door to the deeper things. :)

Other Links to this Post

RSS feed for comments on this post.

Leave a comment

WordPress Themes

Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales
Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales