There has been a great deal of media attention centred around learning to code recently and some really great initiatives have come to light. Arguably leading the charge is Codecademy who are running a campaign to make 2012 ‘Code Year‘. This even reached New York Mayor Michael Bloomberg who declared via Twitter that he was learning to code. This side of the Atlantic Emma Mulqueeny has been leading Rewired State and Young Rewired State to bring coding to the masses through a series of events and various media activity. There are also several other groups doing great work across the internet and down to actual coding workshops. There has certainly been an increase in awareness, including at government level, with talk of updating school ICT lessons to swap Excel for C++ perhaps.
Now, I learned to code when I was 9. I did this on a ZX Spectrum +2 with 128k of RAM.
There were two ways to play games on the Spectrum – the first was via a cassette tape (which made a sound like faxing a cat) or you could type in the code from a book. I enjoyed both routes and soon learned that you could make games easier if you tried to understand the code and tweak it to your advantage. Unfortunately this made the games incredibly dull but I learned loads. One bad thing with the Spectrum was that there was no way to save anything so when your mum pulled the plug out for tea time it was a pretty catastrophic event when you had just spent 14 hours straight coding from a book! Now I know how to code a bunch of things like website and mobile apps and I even built a company around those skills.
I have the great honour to be a governor of Bewdley Primary School. Naturally I look after ICT and with all the media attention on the subject of learning to code I hatched a plan to try and teach some of the kids at Bewdley to code. It started as an idea for the more able pupils but the benefits for the kids in terms of confidence in the subject and eventually their job prospects seemed pretty important also. My first idea was to use the school computer club but it was hard for me to commit to one time every week so after much discussion with Paul Roper (the head teacher) we decided to run a whole day workshop for the most suited kids from each of the four pyramid schools – Bewdley, St. Annes, Far Forest and Arley. The date was set as the 22nd of February and six pupils from each school were invited.
That left me with the problem of planning a whole day of teaching kids to code where I had to keep them interested and not completely lose them after 5 minutes. I did most of a secondary PGCE many moons ago so I had a reasonable idea of how to structure a lesson generally. I wanted to use tools that the kids would have at home so I opted for notepad and for language I decided to focus on JavaScript. I also wanted to make as much of the day interactive and tangable to the kids so I wanted to spend as much time as possible with the kids making something visual.
I decided on an initial set of learning objectives:
- What is a string?
- What is the difference between a string and a number – “6” != 6.
- What is a variable?
- What is a function?
- How do you create a function?
- How do you make a function run?
- What is a Boolean?
- How does an if statement work?
- What is a programming loop?
- Basic HTML.
I also decided that to not require any server scripting and to be visual, some sort of image search tool would be good to make. This ended up using the Flickr api.
I had a few times dictated to me – the start and end time as well as lunch and break time. Also, I would have the help of the teacher I am paired with to look after ICT – Amy Crowther as well as one colleague, David Titley, who is also a coder so would be able to support debugging en-masse.
Finally, I decided on a running order of:
9.00 – 9.15 Orientation (Amy Crowther)
9.15 – 9.30 Introduction (Me)
9.30 – 10.05 Strings, numbers & variables
10.05 – 10.20 Break
10.20 – 11.00 Logic, loops and functions
11.00 – 12.00 Building a web-app
12.00 – 12.15 Working with code (as a job generally)
12.15 – 12.30 Q&A
12.30 – 1.30 Lunch
1.30 – 2.45 Challenge (the kids could try to change the app we made)
2.45 – 3.00 Showcase (see what the kids had managed to do)
As it transpired this was a little optimistic but I was as paranoid about having too little to do as I was about having too much so I recognised that everything after building the app initially was optional really.
So, on the day we started as planned and rattled through the theory sections. I looked at the clock when I finished the first half of the theory (strings, numbers and variables) and it was just 9.30 – time to start that section! This wasn’t helped by the fact that I had meant to use Codecademy as an exercise in the middle but it doesn’t work on Internet Explorer and like most schools there is no other option on the computers.
In retrospect I should have used the next 30 mins to really reinforce those points but more on that in a minute. Anyway, I carried on with the plan and ended up having done all the basic theory by break time. Some of the kids definitely got it but it was really the same four or so that were answering my questions and Amy said that tons of the kids looked pretty baffled. She fetched some mini-whiteboards and we started the next session with a great exercise in re-enforcement going over all the concepts and building up from a number to a string, to a variable and then into an ‘if’ statement. After half an hour of this the kids looked generally pretty happy with the ideas and they answered my questions correctly at least. If I were to do this again I would definitely integrate the whiteboard exercise through the theory and maybe even keep to time. One thing that I really got wrong was that I had assumed the kids would know what algebra was and I intended to explain a variable like an algebraic ‘x’. They didn’t actually know what algebra was but I think they followed the logic anyway. So, I guess I taught them algebra as well as coding that day?!
Now we had the basics under control I decided to get going with the web-app. I had broken the coding down into a number of sections and we went over them one at a time. At each step we went over what the code did, then the kids typed it in, had it checked, and then we repeated the discussion of what the code said. It took far longer than I expected to do the coding but we got there eventually and finally, just before 2.30 when many of the kids had to leave about half managed to get some images to load with their their own code. I finished off by congratulating them and reminding them that all they had used was notepad and that this was where the power of all this lay – they could go home and make pretty much anything if they just know enough code!
So, what did I learn? I learned a bit about teaching at primary level and I learned that it is pretty fun although REALLY hard work! I learned that if you make a complex subject engaging kids will learn it and are probably capable of a great deal more than they are often given credit for. The youngest kids on the day were year four which is aged 8-9 and although they were definitely more able than some of their peers, you can expect that by year 5-6 (aged 9-11) probably a lot of the kids could follow it and indeed learn to code. And you know what? It might just change their lives!
I recently introduced programming to my first graders through Kahn Academy. I showed them how you can go to Hypnoswirl (http://www.khanacademy.org/cs/hypnoswirl/826002294) and change the values, and then they “played around with the numbers.” I know it’s really basic, but it allows them to see what code looks like and also teaches them to connect changing numbers in code to changing the program.
I thought it was pretty cool, and they did too.