Vladimir Klepov as a Coder

Programming is Like Writing

I’ve been playing around with this idea for a while. The more I got into writing (Strunk-White and William Zinsser’s “On Writing Well” are most suggested), the more similarities to software development I found. Now I’m ready to put it forward: writing code is still writing, or writing code is writing, or maybe even “you’re writing code”.

After some online research this analogy does not seem as fresh. Jeff Atwood in Coding: It’s Just Writing notes the similarities between William Strunk’s tips on writing and programming best practices, and then there’s Bert Wagner talking about the psychological similarities between coding and writing. On the other hand, the topic does not seem completely dead either, so watch me take another stab on it!

You produce text (not really)

On the surface, the end result of both writing and coding is text (as in “a sequence of words with some meaning”). However, this view breaks down once you think about it.

People in the software industry know that the value they provide is in solving business problems through code, not in writing code per se. Yet I don’t feel “shoving shitcode on top of shitcode to make things work” is the way to go. Let’s ban the whole business / technical argument for a minute.

This is not why people like open source

The users do not care for the code — they only see the GUI (or an API). What code you wrote in there is irreleveant as long as it works. When your users start caring about the code, it’s either because they want to learn from it, or because you screwed up and they have to dive in and debug. Not the primary use cases, huh?

But writers do indeed write texts. Or do they? A piece of writing is only valuable once you put it into your head and think about it. Very much like running a program, isn’t it? A good book is good because of the feelings and ideas it gives you, not because of the arrangement of words. Still not convinced? Think about play- and screenwriting: there is no text in a movie, yet the writing itself sure as hell is there.

Now, who carese about the word arrangements? Literature students do: they learn the ways to use words for the desired effect. When the text is so bad you can’t make sense of it (some lawyer mumbo-jumbo), you read it over and over again — isn’t it “text debugging”? Bingo on both!

You’re transmitting intention through text

And text is not even the best medium for what we the writers (see what I did there?) are trying to acheive. But we don’t know any better, so we settled on it somehow. We just want to communicate the ideas in our heads: algorithms, storylines, all is one.

The attempts to run away from the text? Check! Visual programming and comic books, respectively. However, people do not take these too seriously. Don’t grumble, give these some time and they will outshine the poor old text.

People think complex and long is cool (it is not)

What makes a writer good? It must be all those fancy baroque wordings! I heard James Joyce was good, and you can barely make sense of his books. The more grotesque plot twists, the merrier. But didn’t the greatest writers always talk about working hard to keep their works simple?

Now, what makes a programmer good? It must be all the fancy optimization hacks! How cool, this dude uses Singletons, Message Queues and Service Workers! No one can understand this code — what a work of genius! Sounds familiar? If you program, you know it’s bullshit. The best code for the job is the simplest code for the job — it’s easy to follow and does not strangle the performance with all the unnecessary layers of abstraction.

Teamwork is limited (it is still there)

Ten writers working on a book won’t write it ten times better or faster than one. Similarly, if you give one task to ten programmers with no management, they would drown in merge conflicts before delivering.

However, teamwork does exist in both industries, and is strikingly similar. Our code reviews = writers’ proofreading and editing. I remember Hemmingway’s quote about how cool his editor was, but I can’t seem to find that one now that there’s some proofreading software called Hemmingway — hope it edits sober. And you know how the code collapses into anarchy once there’s no one to stop you and watch with a clear eye.

The conclusion (I am so serious)

And I feel that as exploring other areas — art, cooking, construction, retail, what not — I will find even more structure to all of these. So make sure to come by when I publish more posts on “Programming is like Making Pasta”, “Hackathons are Like Doodling” and “Working in Outsource is Like Being an Illegal Plumber”.

More? All articles ever
Written in by your friend, Vladimir. Follow me on Twitter to get post updates. I have RSS, too. And you can buy me a coffee!
Older
Quick Tip: docx is a zip Archive
Newer
Simpifying AngularJS controllers with ES5 get / set