When people who program want to convey to others the joy and satisfaction we find in our craft, we often liken it to doing magic. The analogy evokes a sense of empowerment, possibility and freedom. But I think comparing programming to magic actually does unintended harm, because it has another connotation: that programming is a mystical ability, something you are born with, not something you can learn.
I want to get a lot more people programming, and I think we need a better analogy to get there.
Yer a wizard, Harry
People compare programming to magic with the best of intentions. In a heartfelt and inspiring keynote at Strange Loop on the importance of sharing the joy that programming brings us, Carin Meier likened programming to dreams of flying. A Kickstarter project CodeSpells offers to let you “express yourself with magic”. Fred Brooks wrote that the programmer “builds castles in the air”.
As a way to inspire more people to learn to program, this seems to make sense. Our popular culture is full of magical powers we would all love to have access to: Harry Potter rides a broomstick and fights evil, Gandalf summons giant eagles to get him out of harm’s way, Wolverine can heal from any injury. (Of course, the “mutations” of the X-Men and “The Force” in Star Wars are magic by another name.) Why wouldn’t anyone want to learn something that gave them magical powers?
Here’s the problem: it’s almost always a special group of people who have the magic. Harry Potter learns early on that he is a wizard, and that most other people are not wizards. Gandalf never teaches Frodo any spells. The X-Men have powers because of their mutations - they were just born that way.
When we tell a non-programmer, who has watched Harry Potter and Lord of the Rings, that programming is like magic, he’s likely to respond: “that sounds great; I wish I could do it”. Most people already have little concept of what programming is like. Telling him programming is like magic confirms what he probably already suspected: programming is complicated and mysterious; it’s not for him.
The man behind the curtain
Comparing programming to magic gives people some idea of why it’s fun, but no idea of what it is - or how to learn it. Claiming to be wizards, we are more like the Wizard of Oz - hiding behind a curtain of mystique, magnifying our achievements to impress others. If we want everyone to have access to this power, we need to pull back the curtain.
Programmers aren’t wizards. We’re just people, pulling levers to operate the machine. We learned to program the same way we learned to cook or ride a bike - by trying and failing, changing something and getting a different response, and enjoying it enough to keep going. We need to show what that process looks like, and how anyone with access to a computer can do it.
Programming isn’t magic. It’s building a machine that talks to another machine that moves data around, or makes pixels change colour, or makes a speaker cone vibrate. We need to show how to do those things, and how they add up to produce results that feel like magic.
Robot dance party
That brings me back to the Strange Loop keynote. After Meier’s presentation, she was joined by two live-coding DJs, Sam Aaron and Jonathan Graham. While they built up a soundtrack from samples and loops, Meier set up a menagerie of robots, including a quadcopter, and wrote a quick program to control the robots. Watch the part at 40:30 where she gets the quadcopter dancing to the beat.
Let’s go over that again. Three programmers, with a live audience, made a flying robot dance to music they created. If that’s not a magical result, I don’t know what is.
But it wasn’t magic. Meier controlled the robots by sending a few simple commands to their motors. Aaron and Graham produced the music with a screenful of code, using the Overtone toolkit. Using a simplified version of Overtone, Aaron has successfully taught 12-year-olds to make music using code.
Programming as a musical instrument
The kids in Aaron’s class learned how to play a sample, change the pitch to make a melody, loop it to make a backing track. They learned how to build up several tracks into an ensemble, and how to tweak the music until it sounded good. They learned all this in much less time than they would have needed to learn a real musical instrument, or at least produce any kind of pleasant sounds from it.
Of course, they were also learning programming: how to build up complex systems from simple units, how to debug by changing parameters and observing the change in output. But as far as they were concerned, they were making music.
So if we want the rest of the world to have magical powers too, maybe instead of comparing programming to magic, we should compare it to music. Programming is like a musical instrument. A beginner can play simple tunes, and as they grow more adept, they can add chords, harmonies, counterpoint. Not everyone can write a symphony. But we can all make robots dance.
Inspired by a conversation with @roseaboveit.
Lego photo credit: evaysucamara
This was originally posted on LinkedIn
Comments are disabled, but please feel free to reach out on social media if you'd like to discuss this post!
Comments from a previous URL for this post (which now redirects here):