I was speaking to a fellow editor recently and confessed my secret: I program computers for fun.
"Are you sure you're in the right job," she asks.
Yes, I reply, because programming and writing, especially non-fiction writing, are essentially identical skills. I believe that's why there are many good programmers who are also good writers -- Paul Graham, just to take one example. That we don't see too many examples of the reverse is because few writers understand the symmetry.
Both aim to convey information -- ideas, images, numbers and text -- in the most concise and efficient way possible. And both achieve beauty when they succeed. I wouldn't compare programming to Shakespeare, but there's not much separating a good software application from a well-written news story or essay. Software conveys information to a computer initially, while the written word is read directly by a human reader. But even that difference is just a distraction. The ultimate target of both is a person.
I've written for a living and programmed for fun for at least 20 years now and find that practice in one improves the other. Neither can be done well unless I'm thinking very clearly about the problem I'm trying to solve or the ideas I want to convey. Building logically from one point to another, in the simplest, clearest way possible makes good source code and good writing.
And just as learning different human languages can make you a better writer, learning other computer languages makes you a better programmer. I'm absolutely hopeless at learning human languages, and struggle enough with English to keep me well occupied. I studied French for years and still can't ask for directions or understand the answer. I don't remember much about the Latin I studied in High School, nor the Russian I spent two years wrestling with at university, but I do believe I've received benefits from them. I may not remember many specifics, but I do remember the ideas, recognize a Latin root or two and have observed the pluses and minuses of their different approaches. A phonetic alphabet (Russian) is a good thing, for example, as is precision in the choice of words.
I can't claim to be any better at computer languages, but at least I pick them up faster. I've programmed in Basic, Pascal, Fortran, C, C++, Java, Perl, Visual Basic and lots of different application-specific macro languages. My current favorite is Python, and I've written fairly complex graphical programs in it. As with the human languages, I've absorbed them to varying degrees. I can still pick up a Basic program, even though I haven't programmed in the language in any serious way since the Apple IIe, while I would have to learn C++ and Java again from scratch. And, again, I've benefitted from each, because each has a unique way of approaching and solving problems.
Since the beginning of the year I've also been putting in some serious effort into learning Common Lisp, so I'll use that to illustrate some of the benefits.
Lisp has been compared to Latin. In computer terms, it's certainly as old as Latin, dating back to the mid 1950s. But I think it's closer to a language with a completely different alphabet or wholly unfamiliar grammar, like Greek, Japanese or Hebrew. Unlike most modern languages, which are based on a predecessor known as Algol, Lisp isn't written in a way that would look familiar to most people.
The Pythagorean Theorem --
c = √(a²+b²)
-- might be written in a Algol-derived language such as Python, like this:
c = sqrt(a**2 + b**2)
Most people would find that at least familiar, once told that sqrt means square root and ** means exponent, anyway.
In Lisp, however, one way to write the same thing might be:
(setf c (sqrt (+ (* a a) (* b b))))
The inside-out style is definitely unfamiliar, but it doesn't take too many bouts with really hairy algebra or tricky text manipulation to understand that it is more efficient for some problems. There are many tasks that would take several steps in an Algol language, but can be solved with a tight one-liner in Lisp that, once you get used to it, is still readable. Learning a new language, in other words, is forcing me to think differently, out of the box.
Another benefit of putting effort into both disciplines is that it puts you in charge of two essentials of the modern world: communications and computers. The latter is getting as ubiquitous and as necessary as the former. Just as illiteracy can turn a free human being into a slave, computer ignorance will make you steadily less and less in control of your life in the next decades. Kids today are being taught nothing about computers in school except how to run Word and Excel. Who's the master in that relationship? It isn't the student. Programming has made me as confident in wielding a computer as the written word. (Read: not very, but I'm learning.)
The original question -- about whether I'm sure I'm in the right job -- assumes a divide between the sciences and the liberal arts, math and art, computers and words. I don't think it exists. I'm proud to be interested in both.
And, anyway, it's a lot more interesting than doing a crossword puzzle.
Tags: Programming, Writing