On Perfection

What film director Werner Herzog taught me about shipping code.

On Perfection

LXIII

You can’t make something perfect if you don’t actually know what perfect is.

Or, what Werner Herzog taught me about shipping code.

The Elusive Perfect

I’m thinking a lot about the conflict between trying to make something “perfect” and trying to make something “work” when building a product. I’m continually leaning towards making things work camp. This, I think, is a product of realizing how little I actually know about what “perfect” looks like.

Last night, I finished watching Cobra Verde, a film by Werner Herzog, one of my favorite directors. Afterwards, thinking about Herzog’s career was an excellent reminder that the plan reveals itself as you take action. 

Herzog

If you’re unfamiliar with Werner Herzog, here are some highlights: 

  • He stole a camera to shoot his short film when he was 19

  • He spent two years living in the amazon to pull a 320 ton steamboat over a hill for his film Fitzcarraldo

  • Spent a month walking from Munich to Paris in the Winter because he was convinced it would save his dying friend’s life

The man has produced, written, and directed over 70 films, released a dozen books, and directs operas on the side. To put it into modern terms: this guy ships. 

Whose gonna carry the boats?

Movie Scripts

If you’ve seen a movie script, you know that in a sense, they’re pretty rigid. So rigid, in fact that I would compare a movie script to code*. Things are labeled and laid out clearly, so you know who says what when. While it’s not a perfect blueprint for a film, the writer and the director can, in theory, be different while preserving the intentions of the writer. 

In contrast to the rigidity of orthodox script writer, here’s an excerpt from Herzog’s ‘script’ for Nosferatu, Phantom of the Night:

Suddenly the grisly howling of wolves can be heard from outside. Listen, Dracula says, those are the children of night. What music they make! He notices Harker’s terror, but then Harker catches himself and assumes a sheep-like expression. Ah, young man, Dracula sighs, as a city dweller he, Jonathan, cannot place himself in the soul of a huntsman.

Herzog

The lack of convention here would offend the sentiment of many an English teacher grading prose; I can only imagine what someone who spent $250 on a course explaining the conventions of screenwriting might think of it. 

The dialogue is not clearly marked, character names are not in bold, instructions for line delivery are not in parentheses. Shots are unmarked and there are no clear transitions. 

What’s more is that Herzog departs from his scripts when filming. If new information presents itself when he’s shooting, he’ll integrate it into the piece. 

You can view this lack of rigorous planning as the confidence of “I don’t need to plan” or the humble maturity of “I don’t know enough to plan.” I think the insight here is that it’s a mix of both. In other words, Herzog has more confidence in his ability to figure out particulars in real time than he has in his ability to plan everything out in advance. 

*That probably doesn’t mean much, I compare a lot of things to a lot of things. 

Deferred Decision Making

I would consider the most robust piece of the BirdDog code base to be Shelob, our web crawler. When I built it, I heavily relied on the powerful Scrapy framework and made only a few of my own assumptions. Over the last month, Shelob has naturally grown and improved via numerous one to five line augmentations. 

In contrast, on Wednesday, I finished a week-long rewrite of the rest of the code base, including our database schema. Why did I have to do that? Well, I think I made too many assumptions and premature “optimizations.” 

Between my inexperience and trying to build something that does not exist, I’m functioning in an environment with a lot of uncertainty. I do not know what I do not know. If I over emphasize trying to get it entirely right the first time, I make more bad assumptions that have to be undone later. However, if I write something simple that gets the job done, I can make it better over time as it clashes with the real world.

The beauty of this city did not come from one grand decision, but from the culmination of many small ones.

The less I obsess over the “perfect code,” the better my code is. Things that “work” (in practice) can become great over time, while things that “work” (in theory) never get a fair shot at improving.

Quantity vs Quality

A few of my recent posts* have been taking part in the debate of quantity vs quality. When I build something, I want to do the best I can to make it absolutely perfect. Unfortunately, I don’t actually know what perfect looks like, and I won’t know for a while, if I ever do. 

You learn more about quality through producing quantity. 

The elusive “ideal” is brought into reality by improving on mistakes, not by philosophizing about what perfect might look like.

I’m afraid of using this notion as an excuse to get sloppy and produce something of lower quality than I am capable of. After all, I know that I can save time and avoid mistakes by seeing how pieces fit into the bigger picture before I start doing things.

Still, you’re never going to get it right on the first time. Planning is helpful not because it helps you get things right the fist time, but because it helps you get things less wrong.

Conquest of the Useless, Herzog’s journals when he was shooting Fitzcarraldo in the Amazon, are dreamlike and grueling. One quote buried in a humorous anecdote gives me comfort in the notion of embracing the process of creation:

Yesterday I sat on the ground for a long time and cracked nuts with a machete… Anja asked what I was doing… I sat there like a Neanderthal man, cracking nuts… and I thought to myself, I am doing exactly what I can do, no more, no less.

Werner Herzog

Sometimes, you have to sit down and crack nuts if you ever hope to get your boat over a mountain. 

If you’re bored and want more on Herzog, start with this clip of him encouraging you to make eye contact with a chicken.

I hope to be that insightful one day.

Live Deeply,