Buy The Honest Look for the Kindle


Authors, algorithms

On writing computer science in fiction

Charles Lewis 17 February 2013

Hidden in the conundrums and devices of discrete mathematics one can discover allegories to the human experience, an NP-completeness of the soul

Tiny red and green LEDs speckled the room like constellations over the ocean. Guided by the whirring and clicking of hard drives, Carmen slipped out of bed and padded softly to her desk. She wiggled the mouse and half a dozen monitors popped to life, tracking scores of simultaneous experiments. They lit a physical desktop cluttered with handwritten solutions and derivations, elegant Greek script illuminated and realized by the digits on the screens. Carmen, we’ve missed you.

I've spent a lot of time writing code, much more than I've spent writing prose. My interest in programming probably goes back to the geek movies of the 80s, and eventually gained traction at the University of Illinois in Urbana/Champaign where I finally got to write code that could be run in real-time, onscreen, instead of in batch jobs that required a human operator to deliver printed results. The lag wasn't as bad as say, waiting to hear back from a publisher about a manuscript, but eternity comes in different flavors. At that time there was a lot of interest in developing heuristics to emulate elements of human behavior in code. Of late, I have been interested in a transformation that is roughly the opposite – bringing elements of computer science and programming to life in fiction.

In the course of writing my first novel (self-published, thank you), I found it exceptionally challenging to describe the activities and challenges of computer scientists and programmers in a way that could be understood and enjoyed by a wider readership. This is undoubtedly true of writing about any scientific endeavor – every field has its own vocabulary, its own tools, and a unique set of problems that are faced invisibly, between the ears of its practitioners. In the case of computer science, the popularization of technology has made some basic terminology fairly common, but the underlying principles and processes remain obscure to the average reader. Communicating these details can be a challenge, but they also give something back, both as interesting material for fiction and as a sort of meta-layer to the storytelling itself.

To an outside observer, the work of programming cannot be distinguished from thousands of other things we do with a computer every day. Paying bills, writing blog posts, searching for recipes. A casual description of any of these tasks will read something like, "Charles hunched over his keyboard attentively. Then he typed. Then he read from the screen." And frowned. Or snickered. Obviously if we want to communicate something remarkable that is happening, we have to step into the mind of our character. If it is sufficiently abstract, we may even have to abandon our character for a time. When we leave the physical world behind, the real challenge begins.

First, there is always the temptation avert a creative solution by using an acronym-filled monologue that simultaneously establishes credibility and bludgeons the reader into submission. Techno-thrillers of the Tom Clancy variety often do this with long specs for Russian submarines, or descriptions of high caliber sniper rifles. There are drawbacks to this approach, but it would be a shame to give up on the native tongue of our field completely. There is something about the opacity of technical language that contributes to the texture, the rhythm of the environment itself. Open Dr. Dobb's Journal, ACM Queue, or a ranking of the top programming languages, and you will be instantly immersed in this sometimes curt, sometimes whimsical vocabulary (currently the top language is "C", predecessor to "C++" and descendent of "B").

These names and terms can easily be experienced as a kind of found art – Dadaist artifacts, entrancing in their own right, independent of meaning. In technical meetings, I am often struck by how nonsensical, almost Dr. Seuss-like, the conversation would sound to an objective observer. But that can work. Without a background in Machine Learning, one can still feel a glimmer of cold comfort in Support Vector Machines, or an air of mystery around Hidden Markov Models. Terms of art can be appreciated in their own right, as word-images, if they can be used in a manner that is simultaneously evocative and accurate. My favorite examples of this are the science fiction fables of Stanislaw Lem, who deploys enough hard science terminology in his stories to drive a practicing physicist back to her science dictionary, and always with an eye towards colorful story-telling.

Beyond the language itself, incorporating programming and computer science into our writing requires us to convey some technical aspects of the subject without numbing the non-technical reader. We might only cover a small niche, and only to a shallow degree, but this explanation may be critical to our use of the subject. We find ourselves caught between readers who do not need this background and readers who are neither prepared nor interested in a graduate level lecture on the subject. It is up to us to hold the attention of both groups.

In fictionalizing what is happening in the head of a programmer or computer scientist, a common approach has been to build up a visual metaphor for the underlying abstractions at work. The structural foundations of computer science lend themselves well to this. William Gibson is most famous in this regard, creating vivid visual descriptions of cyberspace environments to capture the typically monochromatic act of security hacking. Movies are constantly attempting to represent the abstractions of operating systems and code with immersive special effects (e.g., Wreck-It Ralph). While the hallucinatory images of this approach may not represent the data structures, decision surfaces, or clockwork spin of algorithms with complete accuracy, they at least convey something of the smooth complexity of this world, and can do so while keeping readers of all levels engaged.

Beyond the heft of technical vocabulary, and the dazzle of visualization, the most satisfying technique for sharing the experience of the computer scientist or programming professional is probably best known through the fiction of Lewis Carroll, and the non-fiction of Douglas Hofstadter. Mapping of the algorithms, techniques, and processes of computer science into the narrative itself can transform the text into a direct experience of the science. Recursive text is an obvious example, stories within stories (or what a programmer might refer to as a call stack) are demonstrated in many literary works, most famously in the classic One Thousand and One Nights wherein the stories woven by Scheherazade are nested snugly together within the context of a single meta-narrative.

Computer science can be a rich source for narrative devices like this. Hidden in the conundrums and devices of discrete mathematics one can discover allegories to the human experience, an NP-completeness of the soul. Consider, for example, Reinforcement Learning, an approach to automated decision-making that keeps the program suspended between paradoxical beliefs, constantly testing each against real, experienced outcomes. Or a hill-climbing algorithm, where the only escape for our algorithm from a local maxima is to dare venture downwards, as a Nietschean Untergehende might. It does not take excessive anthropomorphization to find human drama in these mathematical scenarios. If the human drama described happens to concern the algorithms themselves, so much the better. This is where literature and computer science can communicate most closely, sharing each others' secrets.

I've spent a lot of time as a programmer, much more than as a writer. They may seem like disparate pursuits, but I have observed many parallels between them. Long hours alone, at a keyboard. Careful craftsmanship, measured in units invisible to the rest of the world. And always the opportunity to be clever, sometimes much more clever than we ought.

Eventually, all notion of structure was lost. Emission and hidden layers became indistinguishable, devolving into impressionistic splatters of meaning, overlapping, blending into each other. No point of reference remained. He brought her to a place in the system that registered neither precision nor accuracy, a place defined only by its uncountably many connections, like long curving reins, to points throughout the universe.

“Here,” he said quietly. “Try this.”