Skip to the content.

Programming and Writing

(Written circa 2011)

These days I tend to think of computer programming as some kind of technical writing. The major difference being that instead of human languages like English, Chinese and Arabic., we write in “computer languages” like C++, Java and Python.

Computers are more picky about syntax and format, and you need to be very, very precise about what a program should do, but that’s about it.

One of the reasons I see things this way is because the code I write not only target computers, but also human beings1. Contrary to what most laypeople believe, writing programs that computers understand is not the hard part of writing software. The hard part is to get people understand your code, and that includes yourself2.

It’s not uncommon for a project to fail because the code has become so messy and complicated that nobody in the team understands it fully. And since you can’t tell a computer to do something that you don’t understand yourself – at that point the software gets slow and buggy, and usually it’s quite beyond salvation.

As a “software engineer” that spends most of the time programming, I consider myself primarily a writer and an editor. A writer for reasons already mentioned, and an editor because I routinely “fix” code that look “ugly” or “wrong”, meaning that they are organized or presented in counter-intuitive ways.

I’m sure a lot of people in the field would balk at the analogy. Many more people do compare programming to mathematics or logic. Yet in reality, I find myself dealing with text more than symbols, with readability more than logical induction. I deal with questions of “will the guy sitting next to me understand what I’m writing?”, instead of “how can I prove the correctness of this piece of code?”

Of course, I still have to write software that performs “correctly”, i.e. it still has to do what it’s expected to do. But despite what they teach in computer science classes, I believe the best techniques to prove correctness in most real world software is not by using mathematics, but by making the system easy to understand3. When one understands the system, its correctness (or lack thereof) should be quite evident. Yet when the system isn’t easily understood, it would be like the story of the “blind men and the elephant” 4 – each person sees a different thing, and all lacks the overall picture.

And where else besides literature would one find inspiration on how to write things easy to understand? After all, good writers can present complicated ideas in an easy to understand, and even enjoyable, way.

PS: There are a few corollaries to this view. One of them would be the possibility of giving technical writing classes to programmers to improve their code readability. But hey, I’ve never taken any writing classes before (at least none that aims to make my writing more legible), so I wouldn’t know whether that would work or not.