Advertisement
Tech by VICE

What's the Most 'Cinematic' Programming Language?

Nominees for the Academy Awards of on-screen code.

by Michael Byrne
May 17 2015, 11:00am

Is Python—or the syntactical aesthetic of Python—worthy of the big screen?

Redditor Infintie_3ntropy caught the following Python script making a cameo in Ex Machina, recalling, "When I first saw it I was particularly annoyed since it had nothing to do with what the character was doing. But when I got a chance to see it in detail ..."

He saw this:

#BlueBook code decryption import sys def sieve(n): x = [1] * n x[1] = 0 for i in range(2,n/2): j = 2 * i while j < n: x[j]=0 j = j+i return x def prime(n,x): i = 1 j = 1 while j <= n: if x[i] == 1: j = j + 1 i = i + 1 return i - 1 x=sieve(10000) code = [1206,301,384,5] key =[1,1,2,2,] sys.stdout.write("".join(chr(i) for i in [73,83,66,78,32,61,32])) for i in range (0,4): sys.stdout.write(str(prime(code[i],x)-key[i])) print

Courtesy of another Reddit poster, the actual screen-grab:

Infintie_3ntropy ran the script and found that it outputs "ISBN = 9780199226559," which refers to Murray Shanahan's volume, Embodiment and the inner life: Cognition and Consciousness in the Space of Possible Minds. Relevant! I think. I haven't seen the movie.

Or at least more relevant than most on-screen code.

This got me wondering: What makes for a good on-screen programming language? (I know all programming languages are on-screen, but you know what I mean.) It should look technical, complex, and generally sort of inscrutable. Right? If the human talent is doing their best to ham it up blockbuster-style, it makes sense that whatever code gets cast should be able to follow suit.

The whole point of Python (or one of its central tenets) is that it should be clean and minimal. It dispatches with much of the syntactical "gunk" found in other languages—curly braces, semi-colons—while promising programmers the same capabilities of other languages, but with a lot fewer lines of code. Sparse, elegant, intuitive (to new programmers, at least).

So, while I think Python can play the part, I'm less sure that it's the best choice for wowing everyday moviegoers forever imprinted with that one scene from Swordfish—you know the one. Hacking isn't supposed to be easy.

We can use the Tumblr Source Code in TV and Films—"Images of the computer code appearing in TV and films and what they really are"—as an IRL reference. It's maintained by John Graham-Cummings, author of The Geek Atlas: 128 Places Where Science and Technology Come Alive.

Let's start with the very worst, which is HTML. First, while it plays the on-screen role of super-important but undefined programming language probably more than any other language, HTML isn't really a programming language at all; instead, it's a markup language, code that defines the appearance of a web document and doesn't really do computation. It's not Turing complete, which is sort of the benchmark standard of a programming language, ensuring its ability compute "any" algorithm written in pseudocode (programming language-agnostic programming, basically). (The Turing completeness of HTML is up for debate, but, in principle, no it's not.)

But, whatever. Movie-goers aren't very worried about Turing completeness (most of them). HTML just looks like shit. The screen-grab below (from CSI: Cyber) isn't what all HTML looks like—by any stretch—but taken on average, it tends to start looking like angle-bracket soup. And once you start incorporating PHP and JavaScript ... ugh. It's like soup with clumps of dog hair in it.

What about JavaScript by itself? Well, it is kind of a mess, at least as it's often used by developers, e.g. as a crimscene of bloated, not-really-neccessary frameworks. It does at least look the part of a proper programming language and if you throw in jQuery, you get all sorts of bonus symbols and can wind up with statements like this: $(".cta").click(function(){}). Which kind of looks like what someone might come up with if they were asked to make a fake language for the sole purpose of putting in hacker movies, e.g. a prop programming language.

The screen-grab above is from Godzilla, and Graham-Cummings offers this origin: "This appears to be sample code for Google Maps with google changed to MONARCH."

I'm annoyed that I can't find a better screen-grab from Halt and Catch Fire's foray into assembly language, but here's something. The code appears to have been lifted from this complete program—sleuthing courtesy of pcjs.org—and is indeed written in assembly language, which is basically the last (sort of) human-readable stage of code execution, where higher-level programming languages like Java or C++ are translated into actual machine instructions for an Intel x86 architecture (most computers). The program here has nothing really to do with hacking a BIOS chip (what they were after in Halt) and is instead a trace utility for the DOS operating system, circa 1985, several years ahead of the show's timeline. Whoops.

But the question still is: Does it look the part? Sort of, I think. It's very different from any other programming language and adds a new layer of inscrutability. Yet, it's also very pristine and gunk-free; assembly code kind of just looks like a list. It's the precise opposite of JavaScript, really. So: not an everyday prop, but it has a place.

Lisp shows up a few times on Source Code, and it seems to do the job well enough (above). Part of the problem here is that a lot depends on how code is presented rather than the code itself. If I were to open the Lisp code above in Sublime Text 3, it would be pretty as hell with all sorts of neat syntax-appropriate color-coding. I'm writing this blog post in Markdown right now—which is sort of a lightweight HTML-like markup language—in ST3 and it looks pretty slick and programmer-y on its own.

Well? There are, of course, many, many more programming languages than I've touched on here, and maybe there's a better answer out there. There probably is. For the sake of a conclusion, I'll just say the answer is ... C. C is computing's workhorse meta-language and it's just inscrutable enough. There'd be no hacking—or Python—without it, at least. Mostly, it's an open question. I'd be interested to hear other opinions.

Tagged:
Tech
Motherboard
Hollywood
Hacking
programming
Ex Machina
code
Source Code
algorithms
motherboard show
python
programming languages
swordfish