What computer programming can tell us about writing

I’ve been doing a fair amount of coding lately—I’m working on an upgrade to GrammarTrainer to make it more user friendly and more informative about student progress.

And as I code my way through javascript and ajax and PHP, I can’t help noticing some similarities between expository writing and computer programming.

Good writing requires logical organization; computer programming, even more so. Even though a disorganized program can, in principle, run properly, it’s awfully hard to debug or upgrade—let alone for a new coder to make sense of.

Good writing requires clarity and precision; computer programming, even more so. The slightest lapse yields code that runs poorly, weirdly, or not at all.

For clarity in writing, it’s often a good idea to break long, complex sentences and paragraphs down into shorter ones; so, too, with programming. You start coding a routine, and, a dozen lines in, you realize that the various if-thens, for-loops, and string manipulations actually comprise several distinct subroutines.

Good writing also involves labeling new concepts with evocative words and phrases; so, too, with those subroutines in programming. It’s a lot easier to keep track of what you’ve done if the subroutines—and the variables—have perspicuous names like “setCursorPosition” and “wordStartPosition,” as opposed to “functionA” and “X”.

Good writing requires an economy of words; even more so with programming, where repetitions can slow down run times.

Finally, computer programming involves a kind of creativity that isn’t so different from the creativity we associate with writing. All writing can (or should) involve some creativity, but here I’m thinking of story writing in particular—and of its distinguishing features of plots and characters. After all, plot-like and character-like entities also figure in computer programs. And, much like the story writer staring at his blank page or screen, the computer programmer, staring at hers, has to figure out what events the program should execute, and in what order—as well as who the various actors are, what they’re going to be called, and how they’re all going to conspire to make everything unfold in just the right way.

4 thoughts on “What computer programming can tell us about writing

  1. “And, much like the story writer staring at his blank page or screen, the computer programmer, staring at hers, has to figure out what events the program should execute, and in what order—as well as who the various actors are, what they’re going to be called, and how they’re all going to conspire to make everything unfold in just the right way.”

    SEQUENCE IS HARD

    NAMING IS HARD, TOO

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s