As technology creeps into more aspects of our life, learning to code has become an increasingly-important skill. Apple CEO Tim Cook recently commented to French outlet Konbini, "I think that coding should be required in every public school in the world."
If you have an idea for an app or you'd like a new hobby, follow this overview of how code works and how to get started. In this article you'll find:
With the educational tools available now, you can learn to code whether you're young or old. In the past couple of years Apple has invited a nine-year-old girl and an 81-year-old woman to its annual Worldwide Developer Conference, based on the strength of their debut apps.
I first learnt to code on an Apple IIc, back in the late eighties, building simple text-based adventure games in Basic. I was just 12 at the time, and while there are many more languages to choose from these days and the code has become more complex, it's easier than ever to start learning.
What is code?
Code is the computer language that tells your smartphone or computer what functions to perform. Even a simple task like visiting choice.com.au in a browser relies on many types of code, each with its own language and quirks.
Most computer science degrees at universities teach just one or two of these fundamental languages, because while the language and syntax may differ between codes, the concepts are generally the same.
The concepts are much like the Choose Your Own Adventure books of our childhood – you're writing a series of instructions and variations for every choice you give the user of your code. You start with an object, which could be anything from a button on a website, to a character in a video game.
Next, you can send instructions to the object; when the button is pushed, what will happen? It could be as simple as the button changing colour, or it could move the code down to the next action to take. When you imagine your code as a series of these building blocks, it becomes much easier to tackle.
Scratch and Swift – coding as games
In recent years, code has begun to be taught in a fun and friendly way – giving users actual blocks of code to move around, snap together, and build real, working applications on a visual canvas.
The benefits are immediate; instead of having to type the code yourself, and make sure your spelling and syntax is correct, the code is pre-packaged into little blocks. The blocks are like Lego, only snapping together in certain ways, so mistakes are hard to make and easy to spot.
Popular examples are Scratch, an open source project from the Massachusetts Institute of Technology (MIT), Swift Playgrounds, an iPad app from Apple, and the modding community that has sprung up around the video game Minecraft. All are aimed at children, and feature colourful building blocks and cute characters and animations to keep the exercises fun and engaging.
Scratch is by far the biggest and most active community of budding coders, with over 12 million users and 25 million projects online. The open source project, available on Mac, Windows, Linux, as well as via a web browser, has many benefits beyond its ease of use.
The active Scratch community shares its projects, which makes it easy to find a project to study, or remix and build upon. Its popularity has spawned countless YouTube tutorials to help you get started.
While Scratch is a great tool to get started, the language can only create simple web based games and concept ideas. Swift Playgrounds' code on the other hand, can power real iOS and Mac apps.
Swift was developed by Apple as the preferred language for its iOS devices, and has since been open-sourced, which means Swift could eventually be used to power anything from servers to Android apps.
Swift Playgrounds (which only runs on Apple's iPads) is more tutorial-based than Scratch. Rather than building projects immediately, you learn to code by moving a character called Byte through a series of video game-style levels.
Once you've completed the fundamentals of Swift levels, individual challenges teach you to create games similar to arcade classics such as Breakout, using the accelerometer and physics engines built into iOS.
And, because Swift is a supported iOS language, you can export Swift code into Xcode, Apple's developer environment for iOS and Mac apps, and build an app you could install on an iPhone.
The level of polish on Swift Playgrounds is as you'd expect from Apple, but at this stage, Swift Playgrounds is far behind Scratch when it comes to sharing user generated projects, though Apple has plans to open a Swift user community early next year.
If your child is obsessed with Minecraft, it presents a perfect opportunity to introduce coding to them. Minecraft has a dedicated community of modders who adjust the code of the game to add characters, puzzles, and even whole cities.
The Tynker program simplifies the modding process, using the same code-as-building-blocks method used by Scratch and Swift Playgrounds, to help get kids started.
What began as a side project from Tynker has been embraced by the now Microsoft-owned Minecraft. There's an education edition and a growing community of tutorials, aimed at both parents and teachers for the wildly popular game.
And while Scratch, Swift Playgrounds and Minecraft offer coding between guardrails, you'll be surprised how quickly you'll start to see patterns in the code and understand the concepts. After a few successful projects, you may even feel confident enough to graduate to a more serious coding environment.
Let's get physical
One of the best ways to explore code is to use it to control physical objects. Using code to power a robot to dance is so rewarding, and helps bring hypothetical lines of code into the real world. Both Scratch and Swift Playgrounds allows this kind of real world interaction.
Scratch can be used to power open-source hardware, such as the Raspberry Pi, Arduino, or micro:bit. These tiny computers are designed to perform simple tasks, and are sold in kits for around $100. At a recent education conference, I built an Arduino robot, programmed its movements with Scratch, and then played robot soccer against other attendees.
Swift Playgrounds has official partnerships with hardware manufacturers, including Lego, Sphero, and drone manufacturer Parrot. As you might expect, Apple is behind the experience, but this list of partners will grow as Swift Playgrounds opens up its community.
Swift Playgrounds can be used to program Sphero's SPRK+ Robot and R2-D2 App-Enabled Droid, Parrot's Mambo MiniDrone, Wonder Workshop's Dash and Dot robot toys, and UBTECH's Jimu Robot Meebot.
Where you can learn more
If you're up for a greater challenge, there are many resources to get you started. There are fantastic, free resources on the online such as:
- YouTube is a great resource, not only for tutorials, but also to watch others get started learning to code. It's encouraging to see others get excited and sometimes fail at the same level you are at. One useful resource is an animated tutorial series from Extra Credits, which teaches children a strategy on how to create their first game.
- Lynda is an online education portal with professional tutorials for just about every language you can think of, and many schools and public libraries offer access to Lynda for their members.
- iTunes University offers free coding courses from some of the world's top universities. 10-year-old coder Yuma Soerianto graduated from Swift Playgrounds to a free Swift coding course from Stanford University, before launching his first App last year. He was one of the young Australians invited to Apple's Worldwide Developer Conference after impressing the company.
- Code Camp is another excellent resource to kick-start a child's interest in coding. Code Camp offers after-school and school-holiday workshops in 92 locations across Australia. Code Camp offers four different courses, from beginner to advanced, for kids as young as five.