Hour of Code: five steps to learn how to code

Classroom-462x346Next week sees the Hour of Code concept arrive in British schools. Imported from across the Atlantic, the Hour of Code aims to show children “how fun coding is in just one hour”, so that Britain has a future generation capable of programming more than the timer on a microwave oven.

Whilst the ukcode.org website claims that more than a million students in the UK have already tried the Hour of Code, some (perhaps, most) schools will inevitably be unprepared, so here’s how parents, teachers or indeed anyone can get started in programming.

1. Take a reality check

First, drop this ridiculous notion that you can learn to code in an hour, or even a day. Anyone who says otherwise is deluded — and that includes the executive director of Year of Code, another government-backed initiative to get people programming, which is led by someone who freely admits she can’t code herself, yet seems to think it’s no harder than cooking an omelette.

Writing code is tough, and it’s an insult to legions of programming professionals to suggest otherwise. But an hour is just long enough to start learning the fundamentals, experiment with different paths into programming and potentially whet the appetite for future learning. Manage your expectations: you’re not going to be hand-coding the next WhatsApp in less time than it takes to watch The Voice.

2. Pick up the principles

If a child’s – or even an adult’s – first exposure to programming is sitting down to write lines of code, it will be a miracle if they even last the hour.

First you need to understand the basic principles of programming, and sitting in front of a keyboard isn’t the best way to do that. My first exposure to “programming” was as an eight-year-old, punching basic commands into my cousin’s Big Trak – a programmable, battery-operated truck that ruined many a skirting board in the 1980s.

The modern-day equivalent of Big Trak (which is still available, by the way) is Light-bot, a free app for Android or iOS, or playable in a PC’s web browser. This game – designed specifically for Hour of Code – invites players to program a little robot to get from one end of the course to the other, gently introducing concepts such as procedures and loops along the way.

Screenshot_2014-02-28-15-08-561-461x292

The free Cargo-Bot app, alas only on iOS, cranks up the difficulty, and makes a good starting point for older children, or even adults. The game introduces programming concepts such as loops and variables, by challenging players to move crates from one end of the loading bay to the other. The learning curve is a little steep, and pay close attention to the tutorials, because you only seem to get one stab at them, but it’s a great way to get children thinking logically.

3. Start from Scratch

A halfway house between gaming and full-blown coding is Scratch. This beautifully designed software lets you design your own games using code building blocks, which you drag and drop into place to create your own programs. There’s a large library of built-in animations and characters to choose from, or you can create your own characters – either by painting them using the game’s built-in bitmap editor or by uploading digital photos.

Scratch is available as a free download, or can now be run directly from the browser on the Scratch website. We’ve written tutorials on how to write Scratch games but I’d also recommend this Code Club tutorial (PDF) for beginners.

Kodu-462x288

Older children might want something with a bit more graphical sophistication than Scratch, in which case they should graduate straight to Microsoft’s Kodu Games Lab. Kodu started life as an Xbox project, but was recently released as a Windows 8 app with full touchscreen controls, and is also available for previous generations of Windows. Kodu lets you create your own 3D gaming worlds, and then program the in-game characters and objects using a vast library of commands and variables, all of which are available by clicking on the character/object involved and selecting commands from the fly-out wheels.

Microsoft has written a getting started guide specifically for Hour of Code, but if you want to get a feel for what’s possible with Kodu, download the software and fire up some of the sample projects. The sophistication of some of the games created – which range from cutesy platform games to first-person shooters – is inspiring.

4. Play them at their own game: Minecraft

For many parents, tearing their kids away from Minecraft is the problem, but the game can be used to teach them how to code.

A mod called ComputerCraft allows players to build their own computer terminals that can be used to program “turtles” using the Lua programming language, which is widely used in education. Players might instruct their turtles to automatically harvest wood, for example, saving them the hassle of hacking at trees themselves. Or they could protect their property from intruders, by coding a password-protected door.

Duncan Gere has written an excellent four-part tutorial to coding in Minecraft, and there are other ComputerCraft tutorials on this Wiki site.

You’ll need to be fairly familiar with the mechanics of Minecraft before you embark on this project.

5. Start a Codecademy class

If you’re determined to get knee-deep in code from the get-go, there’s no better place to get started than Codecademy. This magnificent, recently updated site offers step-by-step, interactive tutorials in a variety of programming languages, including JavaScript, Python, Ruby and HTML/CSS for those who want to knock together their own websites.

Login with your Facebook, Twitter or Google credentials, and the site will keep track of your progress, allowing you to learn at your own pace and pick up where you left off. In my experience of Codecademy, it’s best to set aside, say, half an hour or an hour each day to keep what you’ve learnt fresh in your mind, rather than attempt to blast through the courses in one go and hope to remember what you did later on, but your mileage may vary.

Codeacademy-462x321

The best thing about Codecademy is that it doesn’t just pile through tutorials, but sets practical projects to complete at the end of each unit, such as creating a restaurant tip calculator in Python or an interactive photo album in HTML/CSS, giving you a real sense of achievement

Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.