I was thinking about what to write about this week when it occurred to me to compare writing to programming. There are a number of similarities and differences between them both superficial and fundamental. I will discuss both.
At the most obvious level, both writing and programming involve placing symbols (letters, numbers, punctuation, etc.), either on paper or typing them into a computer. Sometimes you may spend some amount of time planning before you begin but often you just start, knowing that you are going to have to come back later and refine the product.
They both involve placing those symbols within a structure, either words, sentences, and paragraphs for example in the case of writing, or expressions, blocks, functions, and data structures in the case of programming.
Both writing and programming are done for an audience. Writing is done predominantly for human readers, in particular those that are self selected by their expectations of the content of the work. Programming is done predominantly for future programmers to understand how the compiled program works and, equally import, for a computer to translate into a program that can be executed to render some sort of useful computation. The reason that I say programming is predominantly for programmers is that if it were for a machine you might as well enter the primitive machine instructions by hand. Note that one of the programmers that you are writing for is your future self, long after you have forgotten the details of the program that you yourself wrote.
Another similarity between programming and writing is that they both are best done when the writer or programmer is in a state of flow. Flow is a concept that was written about by Mihaly Csikszentmihalyi. It is a state of mind where people are so involved in what they are doing that nothing else seems to matter. For the writer, the words seem to flow onto the page effortlessly. For the programmer, the code appears on the page as if it was already there, waiting to be discovered.
I have experienced this state of flow both while writing and programming. It is one of the most satisfying experiences I’ve ever had. It is the reason that I continue to write and program. But it is not always easy to attain. Csikszentmihalyi has studied the state for years and gives advice on how to attain it in his books but it is sometimes elusive.
The product of writing and programming are somewhat different. A program is a utilitarian artifact, a tool useful to accomplish some task that would be difficult or even impossible without it. At the same time, it is an expression of the programmer’s understanding of the process that comprises the program. When it is well constructed it has an aesthetic appeal that goes beyond it’s function.
A piece of prose has a similar aesthetic but it may lack the utilitarian aspect that one finds associated with a program. That is not to say that some prose is not useful, just that it is not necessary to be useful to be successful as prose.
I have made a lot of generalizations here. I must note that not all successful programs or pieces of prose fall strictly into the categories that I have described here. For instance, many programs are written strictly for their function without consideration of the aesthetic aspect they might embody. This is the nature of the economic pressures of commercial programming. It is often the case that attention to the aesthetic aspects of programming yields a product that works better, is easier to maintain, and consequently enjoys a longer span of usefulness.
Similarly, not all pieces of prose are expected to be aesthetic masterpieces. The instruction manual of a kitchen appliance is not expected to be read for its artistic merit. It is expected to be understandable and organized in a fashion that renders it easy to find the information that one is seeking. For that matter, not all fictional writing need rank high in the aesthetic ranks to be entertaining and worthwhile to read.
I will assert that learning to seek that flow state when writing or programming can result in a better product when you are finished. It will also result in a much enhanced creative experience while your are producing it.
Which brings me to this final point. It is important to chose what you do with your life carefully. Time is the one thing that you have an unknown but limited supply of. It is important to do everything possible to make what you do both enjoyable and useful.
Be safe, wash your hands often, stay home if you can and wear a mask if you must go out, and maintain social distance when possible.