Skip to content

The Magic of Computer Programming

Posted in Life, and Thinking Out Loud

What drew me to computer programming in my teens was getting to be creative — getting to make things with code. It wasn’t till later that I heard someone point out that the whole thing is like magic. And now I think about it, whoever said that was right.

You make things with words when you program. That is, it’s the closest you’ll get to magic in real life.

The Right Words

Just like with magical spells, a programmer has to put the right words in the right order to make things work. At least, that’s how magic works in most novels. I’ve never read a story where the Wise Wizard tells the Young Hero,

That’s how people normally cast this spell. But really, the main point is to intend the right thing. The words you use don’t matter.

Jim Butcher’s Dresden Files series comes close to saying this, but it’s an outlier.

A Mysterious Mechanism

Also like with magic, it’s a bit mysterious how the words in question work. Most novelists don’t bother explaining the mechanism behind magic in the worlds they create. Perhaps they would say,

Thinking of it as a mechanism, rather than something organic, is your problem. My books follow the Presocratics, not Newton and Seth Lloyd.

But still. Most novels are like Harry Potter: magic is there, and it works, but nobody bothers to explain how and why.

When you write a computer program, of course, you know that it’s the computer — or, rather, the CPU in your computer — that is doing the work. But you don’t have to understand anything about how that happens.

You might even know that your code gets translated into assembly language, which gets translated into machine language, which gets translated into electrical signals, which interact with wires and transistors, etc. But you don’t have to care or comprehend exactly what any of that means. You just say the right things and the universe (your computer) responds appropriately.

Well, your computer responds appropriately when it isn’t being ornery.


Featured image by GuHyeok Jeong, who has provided it under a CC0 Public Domain license.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *