I would like to submit to you the following (arguably crazy) thought.
Assuming everyone reading this has a notion of what a “good” program is. In my world this would generally mean 1) the program code communicates it’s intent well to the reader, 2) the code does the right thing, and 3) it does so in an appropriately efficient manner. Meaning, if you can’t understand the code then you can’t make it correct, and long as it’s not correct, there’s not much value in making it efficient.
In my mind, this should lead to the conclusion being a good programmer probably also means being a good storyteller.
This is not a novel idea, though. Donald Knuth talked about a very similar topic a some time back. He called it “Literate Programming”, and with it, he urged programmers to go about writing software in the same way as one would go about writing literature.
I think there’s some value in this thought, but I think there’s something important missing too. To give you an idea of what, please consider the following quote:
Literature is the art of writing something that will be read twice; journalism what will be read once.
– Cyril Connolly, Enemies of Promise (1938)
If we translate this into the field of computing terms, one might say write code that one only needs to read once to understand. Anyone who’s written any meaningful amount of code sees the value in an ideal like this. But with that in mind, one might also conclude that the art of journalistic writing is closer to our field than field Knuth proposed we should embrace.
Next, let me introduce you to the following opening of an article.
In which the hacker tourist ventures forth across the wide and wondrous meatspace of three continents, acquainting himself with the customs and dialects of the exotic Manhole Villagers of Thailand, the U-Turn Tunnelers of the Nile Delta, the Cable Nomads of Lan tao Island, the Slack Control Wizards of Chelmsford, the Subterranean Ex-Telegraphers of Cornwall, and other previously unknown and unchronicled folk; also, biographical sketches of the two long-dead Supreme Ninja Hacker Mage Lords of global telecommunications, and other material pertaining to the business and technology of Undersea Fiber-Optic Cables, as well as an account of the laying of the longest wire on Earth, which should not be without interest to the readers of Wired.
– Neal Stephenson, Wired Magazine, December 1996.
At the time of it’s writing, this style might have been called long form. Ten years later, the style gets a name; creative nonfiction. And literary reportage. And literary journalism. The purpose of this style is to tell a factual story about real events and real people, while allowing yourself to use story-telling techniques and language that traditionally belongs in the realm of literature.
I think this is a fascinating concept, we can learn something from it’s ambitions.
I would like to submit to you, that – with the right language at one’s disposal – it’s possible to write programs that not just communicate their intent so well that the reader understands everything after having been read once, but also that the program is written in a way that is so engaging and fun to read that we want to read them twice.
Can the Perl 6 language community can make this happen? I wonder.
