Programming is Magic

Thejus Chakravarthy
3 min readJan 19, 2019

I don’t mean magic as in sleight of hand, or illusions. I mean magic as in the fantasy section of your bookstore or streaming service. Wizards and dragons and that sort of thing.

Non-programmers: follow along and I hope it will make sense.

Programmers: if you’ve ever messed up the exit condition for a for-loop, take a look at Fantasia’s mop sequence and I think you’ll see where I’m coming from.

When you start, you learn the vocabulary, the grammar, the syntax. In other words, the basic rules and structures, the rudiments of how it works and responds and reacts. Then, you learn more complex tricks that are the simpler tricks stacked on each other, or twisted around themselves.

True for programming, true for magic.

In magic, there are cautionary tales of students who went too far, tried too much. Without a full understanding, they tried to do something too powerful and it went awry. There is inevitably some elder wizard that says something like, “Be careful what you do with this power. In the wrong hands, bad things will happen”

“Terrible, yes, but great.”

But in programming, there isn’t a clear parallel and there really should be.

A good example of this problem is the dominance of code libraries in web design. If you’re unaware, most of the modern internet depends on collections of a code (usually javascript). And there are a number of web designers/developers who could not function without these libraries. They’ve just become dependent on them for their workflow. These libraries are built by other designers and shared in the finest open source traditions. Everything ticks along just fine, until it doesn’t.

Photo by Jaredd Craig on Unsplash

In 2016, one wizard decided to move his spellbook from one library to another and the internet went kaboom. (Google “NPM left-pad”) He had his reasons, but for all the people who used his work, it must have been horrifying. Like realizing that all the magical food appearing in Hogwarts’ dining hall was because of house-elf slave labor.

Without a deeper understanding of what they were doing, an understanding of the basics and rudiments, they were meddling in forces they did not understand or could hope to control. That said, if you could learn to be a wizard, if you knew magic was real, wouldn’t you do everything in your power to learn it?

So, be aware of the pitfalls but do not let that stop you. If you’ve never learned, now’s the time. If you already know some rudimentary code, it’s time to get into some advanced spellcasting. If you do it for a living, now’s the time to dig a little deeper, to consider the ramifications of your actions and your dependencies, to become a better wizard.

Photo by Franki Chamaki on Unsplash

We live in a time when a tiny bit of code determines who gets health insurance, who passes a class, what you can buy, and whether or not freedom of speech is supported or denied. We live in a time when code allows cars to drive themselves, and houses to turn on and off their own lights and heat. We live in a time of magical assistants, like Alexa and Google and Siri, who can call for help when you are in danger or order fifteen cases of ramen by accident. The backbone of this magical world is code.

Which means each and every one of us needs to become magicians.

--

--

Thejus Chakravarthy

if i’m not optimizing some operations puzzle or the other, i’m probably reading (or writing, apparently)