As with many of us, COVID-19 has given me an abundance of free time, and I’ve been using it to do something I’ve tried and failed to do numerous times over the years: to teach myself to code.
I can remember going straight from devouring HTML For Dummies and using it to build the Shenmue Fan Site, circa 1998, to C For Dummies – how different could they be? The realisation of those surefire smash hit game ideas I’d sent to my favourite developers as a kid was imminent.
That plan lasted all of an evening. HTML and C are quite different, as it turns out.
So, in the early days of lockdown, when I was climbing the walls with boredom, I had a go with Swift Playgrounds, which has recently made its way to macOS from the iPad. It’s designed for kids, but I found myself sitting up late, replaying levels and trying to craft more efficient solutions or or get my head around the logic.
At a certain point, though, it seemed like a waste to be putting so much effort into a kids’ game, when I could be learning the real thing. I had time with a three-week furlough coming up, so I set a lockdown resolution: I will learn to code.
The book that finally cracked it for me was Python Crash Course by Eric Matthes, which I got in a Humble Bundle and, at the time of writing, is once again available there. Python is a popular choice as a first programming language and it gets a thumbs-up from me – it’s quite straightforward, and an interpreted language is more friendly when you’re making those beginner’s mistakes.
What’s more, Python is the de facto programming language of the Raspberry Pi if you want to get into hardware projects and is a big player in proper fields like machine learning too.
Anyway, like most coding books, it takes you through the principles of programming chapter-by-chapter, then into several larger projects that apply your new knowledge into crafting actual useful software. Get that far and the sense of achievement when hours of works takes you from a blank text file to an actual playable game – the first I’ve written in 30-odd years of merely playing them – is something else.
I wrote that! So will anyone else who works through that book, admittedly, but I’ve carried on working on it until my version has music and sound effects, and I replaced the single, ephemeral high score with a persistent top 10 leaderboard. Even writing the lion’s share of the game’s functionality parrot-fashion has taught me so much about the inner workings of how a game is structured.
A project like this, which will give you a useful skill and a sense of achievement, is what everyone needs in these strange times. I’m now confident enough to try putting together a few software ideas that have been rattling around in my head for a while, I’m dabbling in more applied Python books, and I’ve got my eye on finally cracking C this time.
Stay safe, and take advantage of lockdown while you’ve got it.