My friend Josh writes:
Could you compare and contrast your experience with writing code and writing literature? Personally, I think they share many things in common, such as rhythm and flow, common structures/patterns, and opinionated naming/spacing/etc. You did a blog a while back about simplifying language in sentences and that also reminded me a BUNCH of simplifying code.
This is an excellent question. Someone could write a whole book on this topic, and maybe someone already has. I’ll try to restrain myself.
As you mentioned, lots of parallels jump out immediately:
- There’s a first draft, editing/revision, and a polished “final” version that often still changes.
- Quality improves when you get someone else to help with revision.
- You want to be clear and concise — all else being equal, shorter is generally better.
- You need to be skilled at a low level (syntax/grammar), at a mid level (functionality/meaning), and at a high level (structure).
- Literature even has something akin to “debugging,” i.e., Why doesn’t this scene work the way I want?
But there are huge differences too.
It’s a lot harder to be a mediocre programmer than a mediocre writer.
And a lot more impressive, too.
Why? Because almost everyone can write English to some degree, so becoming a “writer” just means honing those commonplace skills by some ill-defined amount.
Programming, by contrast, requires a completely different kind of thinking — it’s a specialized skill that most people simply have never learned. (It’s getting more common, sure, but it’s still relatively unusual.) Programming means thinking logically and mathematically. If you can program reasonably well, that’s pretty cool, IMO. If you can write reasonably well, that’s nice too, but, y’know, get in line.
Also, programming has a higher bar to entry. Anyone with a pen and paper, or a text editor, can write a story. But to program, you first have to:
- Figure out what programming is and how it works
- Pick a language
- Write a program
- Figure out how to execute your code (which may require getting a compiler)
- Fix your syntax errors
- Debug your runtime errors
You can have syntax errors in English, too, and mediocre writers usually do. But nothing pops up and forces you to fix them.
On the other hand, becoming a master writer and becoming a master programmer are about equally difficult, I think. In either case, you’ve moved beyond just the basics of syntax, grammar, spelling, etc. You’re looking for clarity, purpose, elegance, and beauty, and I think that’s equally demanding in either medium.
A writer has one audience, but a programmer has three.
A writer writes, a reader reads. Fairly straightforward.
A programmer, though, has to keep three audiences in mind all the time:
- The computer
- The end user
- Other programmers
The computer is the most immediate audience. The code has to run properly there, or the whole thing falls apart.
The next audience is the end user. Even if everything runs okay at a technical level, the program still has to work like the user wants.
Finally, the code itself has to be written in a way that’s clear and easy to follow so that other programmers can maintain it.
For writers of literature, the reader fills all three roles. The reader is the end user; the reader “executes the code” in their own brain; and the reader sees the source code. In my opinion, this makes things quite a bit simpler for English writers.
The world of programming changes very quickly.
In IT, new languages pop up constantly. New libraries pop up even faster. New standards, new design patterns, new IDEs, new hardware, you name it. Keeping up with the changes is a full-time job.
Yes, a lot of the fundamentals of programming apply just as much today as they did thirty years ago. But you still have to keep up. As the Red Queen says: “Here, you see, it takes all the running you can do, to keep in the same place.”
English changes too, but compared to programming, the pace is positively glacial. Pick up a 100-year-old novel and the style will only seem slightly antiquated. Pick up a 10-year-old program and the first thought will be, “How can we get this up-to-date?”
Standards for programming are far more rigorous and precise.
Almost anything you do as a programmer is governed by a standard. Python syntax is extremely well defined, and it is defined by a single specification. User interface design? There are standards for that. Software structure? Standards for that too. Not all of it is perfectly defined, to be sure, but there’s a remarkable degree of clarity about what you’re “supposed” to do.
English has standards as well, but they’re a lot fuzzier.
Even at the most basic level — spelling, grammar, punctuation — there is no single, precise standard. Dictionaries differ, and none is universally accepted as “the” dictionary. The same goes for style guides. And even if there were a gold standard, there would always be exceptions, because language is fluid and slips out of any mold.
At the higher levels — plot, character development, style — things get even fuzzier. Sure, there are recommendations and guidelines, but they’re often contradictory, and many of the best stories throw them out the window. The only real advice is “Figure out what works, and do that.”
This makes life harder for programmers — but easier too.
Harder, because there are a lot more hoops to jump through to get it right. But easier, because someone actually tells you what to do. I don’t want to minimize the independence and creativity that programming requires, of course. But as a writer, I can’t even imagine a document, or set of documents, that could outline English with anywhere near the precision of a programming language.
As I said, I could probably ramble on for
years hours, but I’ll stop there.
Anyone who hasn’t asked a question yet, feel free!