Blog Viewer

SSPA Blog: Writing Programs vs. Writing Books: Which is Harder?

  
In a recent blog post, John D. Cook quotes the legendary computer scientist, Donald Knuth, who said, "[writing] software is hard." Knuth goes on to say, "The amount of technical detail in a large system is one thing that makes programming more demanding than book-writing."

As a book author myself, I have to agree. And although Knuth didn't have blogs back in the '70s and '80s, I'll add that programming is harder than writing a regular blog---even a blog about statistical programming.

Why is programming harder than writing a book or a paper? Knuth claims that programs must "make sense to a computer" and not merely make sense to humans. That is certainly part of it, but here are some additional reasons:

Writers can use examples; Programmers must be explicit.
How many times have you read prose that began, "For ease of exposition, consider the two-dimensional case"? Or a statistical analysis that begins, "consider the following example data"?  Humans can generalize from the specific to the general, and writers exploit that fact. Computers, however, must be given explicit instructions for solving the general problem.

Writers can omit special cases; Programmers must handle all cases.
You can describe an algorithm to a human without saying, "Oh, by the way, if your data has a single observation, then it doesn't make sense to ask for a regression line." A programmer must handle special cases that are associated with degenerate data.

Writers can make small errors; Programmers cannot.
When a writer makes a small typo or grammatical error, it usually doesn't matter. The human brain mentally corrects the error and continues reading. Even when the error is severe, it doesn't ruin the entire book, nor does the publisher have to ship new, corrected, editions to everyone who bought one. Computer errors, however, can be insidious.

Writers are finished when they publish; Programmers support code indefinitely.
When a writer publishes a book, he is finished. A second edition, if it appears at all, won't be published for a while. In contrast, when a professional programmer completes a version of software, he begins on the next software project. In addition to writing new code, programmers are responsible for maintaining and extending old code, even when the underlying infrastructure changes. This can lead to a situation in which a programmer spends the bulk of his time maintaining old code. Rarely do writers spend the bulk of their time revising their old books!

So when you read a good book, appreciate the author’s skills. But when you run a useful program, appreciate the programmer’s skills even more!

1 comment
14 views

Permalink

Tag

Comments

06-20-2011 23:44

I've written 7 statistics books since 2001, all of which have involved considerable programming. The first entailed re-writing the Generalized Linear Models function I wrote in 1993 for Stata. My most recent involved preparing the COUNT package for CRAN, with many new R functions and scripts for count models. My point is that many books now combine writing and programming. The research that goes into preparing well expressed text takes time, as does writing generic software functions. To say offhand that books are easier to prepare than writing software is an oversimplification. But I think that writing a 650+ page text with lots of code, in depth research, and derivations of a host of statistical equations is more challenging and difficult than writing a software function - including large ones such as GLM. Much more difficult. Joseph Hilbe