{ End Bracket }

Is Programming an Art?

Stanley B. Lippman

People who are only users of software frequently fail to appreciate just how very hard it is to write. Oh, the design and initial development are the fun parts. The difficult part is getting it to run correctly (and fast enough). It’s as if for a programmer, a meal begins with a scrumptious double fudge mocha cheesecake and ends with creamed spinach.

The reason we say programming remains an art, not a science or an engineering discipline, is because we haven’t as yet been able to break it down into component steps and mechanize it. Once we succeed in that, a new scale of possibility emerges: programs to write programs from people-oriented design languages (PODL), programs to prove program correctness, and to analyze and support semantic query. Until then, however, programming remains an art, or so conventional wisdom has it.

But as with much conventional wisdom, this analogy does not hold up to closer inspection. Crafting a program (and I’ve done this for over 20 years) is, in fact, nothing at all like art—at least not the art of writing fiction (and I’ve done that for over 20 years as well). Let me illustrate my point with these two fragments of program and prose.

This first piece is part of a lexical analyzer for parsing Visual C++® 7.1. It looks like this:

if ( index >= TokenID::lastKeyword() ) {
    string token = tokenString( index );
    if (( isdigit( token[ 0 ] )) || ( token[0] == ‘-’ )) {
#ifdef TELL_ME
        display( "!! TokenSet::tokenIdentify: ", 
                     "a literal digit: ", token );
#endif
        return TokenID::TK_Literal;
    }
}

This second piece is the opening of a story I wrote some 27 years ago while living in Tucson, Arizona, teaching and writing prose:

We were her pride of 10, Miss Steward named us: the Prodigal, Phoenix,
Benjamin, and perspicacious, pacific Suzanne. Hush, child. Benjamin, be 
still, Miss Steward commanded him gently. People are never just.

Both pieces were extensively designed—that is, I spent a great deal of up-front time designing the architecture of the overall work, and the fragments reflect that design effort. The program has one performance flaw—I retrieve the string entry in the associated string table by value rather than pointer. If the code were to be moved to production, it would require an obvious revision. It has nothing to do with correctness but simply with performance. For a small source code program, the difference in speed is not measurable, and so I chose the cleaner but slower object syntax since I dislike the C/C++ pointer manipulation tokens.

While my prose has not attracted millions of readers, those who do read prose appreciate the craft with its emotional weave under a rigorous symbolic framework. Those who do not appreciate the prose tradition find it mystifying because there is nothing functional about it. The purpose of art is to project feelings and the reality of a subjective private life in the midst of public events into a particular plastic medium—words, in the case of prose. Of course, there is no value in that, not like the value intrinsic to a program.

I like the design process of a program and working out how the different parts of it interact. I like defining abstractions or families of abstractions. I consider them my cast of characters. And I like doing interfaces, because those are the things my characters do to one another. And that’s really how I write programs.

I don’t like writing expressions and statements. I wish we had a symbolic programming language I could think in better and keep in my head. I can’t, frankly, keep arithmetic expressions and parenthetical nestings clear. While I can keep eight separate sections of text in my mind and contrast and echo them, I can’t make sense of a program beyond the classes I design and their interfaces.

In John Markoff’s excellent history of the PC industry, What the Dormouse Said, he states that the goal of the initial visionaries—to put a computer at the disposal of every person—has been realized. But he’s wrong. It has only been half realized. What good is all that computer power for a person, if that person can’t themselves program it? We haven’t realized their dream yet because we haven’t yet figured out how to make programming an art so that everyone can share in it. Until we do that, programming remains neither a discipline of science nor a domain of art. For now, programming is little more than a new-fangled alchemy. Nobody really understands it and nobody as yet has turned a specification into real gold.

Stanley B. Lippman began working on C++ with its inventor, Bjarne Stroustrup, in 1984 at Bell Laboratories. Later, Stan worked in feature animation both at Disney and DreamWorks and served as a Software Technical Director on Fantasia 2000. He has since served as Distinguished Consultant with JPL, and an Architect with the Visual C++ team at Microsoft.