Learning how to code has never been more fashionable. Beyond its utilitarian value, coding can be delightful. Find the correct set of instructions and you can coerce your machine to simulate the solar system, visualize the rotation of three-dimensional objects, or chat with people on the other side of the planet.
Indeed, many have compared coding to magic, and not in the prosaic sense that things just work, seamlessly. When people say that coding is magic, they mean that coders can transform the world, as though with incantations and spells.
The comparison is less fantastical than it seems. There is a craft to sorcery and there is a craft to computer programming. As described in Lev Grossman’s The Magicians trilogy: “even the simplest spell had to be modified and tweaked and inflected to agree with the time of day, the phase of the moon, the intention and purpose and precise circumstances of its casting, and a hundred other factors.” In the world of programming, modules must be imported correctly in order to have the desired power, each function has a specific set of parameters and inputs that must be used properly, and every line must be without the slightest error. Programming and magic require precision.
The difference, of course, is that magic is not real. Returning to Grossman’s description, magic is founded upon bridging the distinction between words and the wider world around us: “in the heat of magic that boundary between word and thing ruptures. It cracks, and the one flows back into the other, and the two melt together and fuse. Language gets tangled up with the world it describes.”
But the gap between magic and code is shrinking. We are now awash in a world of Slack bots and messaging apps—artificially intelligent text chat services that allow us to do an increasing number of tasks via something akin to a command line. These bots provide us a mechanism to use commands—textual magic—to perform things in the real world, from requesting cars to ordering food. And with the advent of such devices as the Amazon Echo, you can utter something that feels very similar to an incantation, summoning a device to do your bidding.
We are repeatedly told that software is eating the world . Technology is dematerializing huge swaths of our lives, turning our world into bits. One of the early shifts involved photos moving into the digital realm, but now websites have replaced newspapers, maps are apps, and mail is email. In science, we are on the verge of replacing the messiness of laboratory experimentation with cleanly written computer code: an automated robotic lab will run complex biological experiments based on the instructions we write. As these abilities expand, we are increasingly being given the power to query how our world works simply by asking questions, in the precise commands of our code.
In the more theoretical realm, we are told that our reality is, at its foundation, ultimately computational. The dominions of bits and atoms are one and the same. Everything is information and the very physics of our world is computational, or even mathematical.
Of course, it is one thing to say that software is eating the world or that everything is computation, and another to say that if you simply write the correct words, then you can do anything you want, in the manner of a magic spell. While it seems that we are inching towards this world, we are by no means there yet. To run a science experiment in the cloud, someone needs to have laid the groundwork. They need to connect a centrifuge to a server, or build a genetic sequencing machine that can interface with the right piece of software. While there is a craft to both magic and programming, unfortunately, technology doesn’t “just work,” at least not yet. A magic wand, along with the proper pseudo-Latin phrase, will not make your printer work if it’s not connected to your network.
But someday it might. We now have chatbots that let you easily manage your tasks or schedule appointments, and voice-activated assistants such as Siri or Alexa that allow you to use natural language to answer trivia questions or call for transportation without the need for esoteric programming knowledge. In this new world, the barriers to sorcery are being lowered.
Maybe, at some distant point in the future, reality will catch up with the universe-creating software from Neal Stephenson’s In the Beginning was the Command Line :
The cosmic operating system uses a command-line interface. It runs on something like a teletype, with lots of noise and heat; punched-out bits flutter down into its hopper like drifting stars. The demiurge sits at his teletype, pounding out one command line after another, specifying the values of fundamental constants of physics:
universe -G 6.672e-11 -e 1.602e-19 -h 6.626e-34 -protonmass 1.673e-27….
and when he’s finished typing out the command line, his right pinky hesitates above the ENTER key for an aeon or two, wondering what’s going to happen; then down it comes–and the WHACK you hear is another Big Bang.