Bloodborne: In Search of True Programming

Bagoum
6 min readJul 14, 2018

There’s something peculiar about the snakes in the Forbidden Woods.

These snakes are not singular, in the fashion of the serpent in the Garden of Eden, nor are they multi-headed, in the fashion of the Hydra. Rather, they are intertwined, as distinct beings under a single banner. This symbol is impossible to resolve — until we consider that it perhaps represents a certain programming language: Python, the icon of which is two snakes unified, but distinct. This opens up an entirely new interpretation of Bloodborne: a reading in terms of software engineering.

You, the “Hunter”, are a computer science graduate looking for that mysterious substance known as “professional experience”. So you make a contract — an (unpaid) internship — with a questionable company in the middle of nowhere, and are promptly set to work on fixing their crappy software.

They don’t even provide on-the-job training!

You smash errors, undocumented functions, and the horrible abomination that is duck typing everywhere you go. But it’s not enough. Unnerved by the unresolved silence after clearing out the last JIRA bug ticket, you realize that the problem isn’t the code — it’s the language. And so you descend into the dark and forbidden woods that are the Python implementation.

Debugging the language is, of course, terrifying. While languages normally seek to make themselves as invisible as possible, here the Python bursts out of every crevice and assaults you. There is no map, no hope, no way out, but in a far corner of the codebase you catch a whiff of something greater — some kind of coding technique that is mathematically rigorous. Of course, having grown up on Python, you ignore this absurdity. You’ve seen the C++ programmers. They’re crazy.

“I swear, this framework is good, man!”

Towards the surface of the language, you might meet a man who has dedicated his life to crushing bugs. Honorable and dedicated though he may be, you see that his efforts are misdirected: it is not the bugs on the surface that we should fix, but the ones deeper down — the great errors at the root of the language.

You might also meet someone who has lost patience for the half-assed measures of a language like Python. How can you justify, he asks, condemning the anarchic freedom of JavaScript while simultaneously accepting the vagaries of Python? How can a dynamically-typed language consider itself naturally superior to a weakly-typed language? But you are faithful to what you learned: Python is the truth, and JavaScript is the worst language in modern usage (except PHP, everyone hates PHP). So you ignore his words too…

Finally, you come across the guardians of the language: the Python Core Devs. They have merged with the Python, and steadfastly shoot down every suggestion you make to change the language. But you outmanouever them. You have the power of youth on your side. As they say, only the yung’uns write revolutionary code.

Python Core Devs

You finally arrive at a place that is somewhat… serene. It’s the research division of an ancient corporation. Technological corporations have always been subject to the schism of forward-looking research interests, whether that be theoretical work or the construction of a better language, versus the immediate demands of applying imperfect knowledge to make money. This one seems to have abandoned R&D. Plenty of theoretical work on various languages has been done here, but now it’s only an empty husk, with only one man nearby: the great master of Python, Guido van Rossum — now long retired. Powerless, he can only feebly point…

You thus find the Great Bug: the code at the very bottom of the language that simultaneously supports and corrupts. For no other reason than to kill the time until you get a real job, you destroy this bug too. But there are some bugs better off not being fixed. Now, all the paper code relying on this hacked-together language feature comes undone. The language collapses. When you return to the surface, you can only see an unholy flood of bugs bursting out of their prisons, and every Python programmer is out for your head.

The Great Bug that holds up the language.
The bug reports that start rolling in when you fix the Great Bug.

You, of course, escape, ignoring all of the bugs as you run past them. They try to snare you with issue reports on Github but you’ve already deleted your account. You end up in the refuge of an ancient library, where you find a magical object — some say it was once called a “book” — detailling the thoughts of an esoteric group of developers from the ancient years of the Second Millenium. They claim to have seen the true form of programming: functional programming. But for some reason, their words are utterly incomprehensible. Are they insane, or is this just the unfathomability of the truth?

“Once you understand monads, you immediately become incapable of explaining them to anyone else.”
- The Curse of Lady Monadgreen

When you finally make it through this unintelligible blabber about monads and functors and applicatives and pointfree code (not to be confused with pointless code, which is what you’ve been writing all your life), you are confronted with something even more incomprehensible: category theory. Here the theoretical mathematicians have descended to provide rigorous proof of the power of functional programming. You realize that you shouldn’t have ignored the weirdos back in the Python spec. This is the great truth, the unspeakable truth, the terrifying truth, before which the ducktypers of Python can only grovel.

The specter of a math professor, whose words are recorded in this “book” of antiquity.

You close the “book” and return to your main work at the company, where all the software is on fire thanks to your fuckups. Your manager and HR rep call you in for a daily performance review. They offer to let you off easy and fire you. But you refuse: your soul has been imbued with the force of mathematically rigorous functional programming, and so you smite your manager, who is still using Python2.6.

When you tell an old man that Python2.6 is outdated

Hearing the commotion, the CEO, a theoretical mathematician who traded his soul for money, descends from his penthouse on the 666th floor and challenges your commitment to functional programming. If you fail his test, he’ll trap you forever in the bureaucratic hell that is the Japanese nenkoujoretsu system of age-based career advancement. If you defeat him, you can move to San Francisco, create a startup to promote functional programming, and bring the world out of the dark ages of Python.

First question: How can you write liftA2 f a b using <*>?

I hope you studied category theory.

If not, you can always clap or retweet this article and hope someone else knows math.

--

--

Bagoum

Software engineer, epic gamer, and Touhou fangame developer.