<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<link rel="self" href="/Atom/" />
	<id>http://billmill.org/</id>
	<title>My Name Rhymes</title>
	<subtitle>Bill Mill blogs irregularly</subtitle>
	<updated>2007-12-28T01:14:00Z</updated>
	<author>
		<name>Bill Mill</name>
		<email>bill.mill@gmail.com</email>
		<uri>http://billmill.org/</uri>
	</author>
	<link href="http://billmill.org/" />
	<entry>
		<title>Poe on Programming</title>
		<link href="http://billmill.org/poe.html" />	
		<id>http://billmill.org/poe.html</id>
		<updated>2007-12-28T01:14:00Z</updated>
		<summary type="html">One of the strongest influences on my programming has always been an essay I 
read in my sophomore year of high school, around about the same time I began to 
feel the magic of programming. Mr. Carino was a young man just out of college, 
a &lt;a href="http://en.wikipedia.org/wiki/Slayer"&gt;Slayer&lt;/a&gt; fan and ardent Twain 
admirer, and a man who would disappear mysteriously a year later. That year, 
though, he gave the most electric class I've ever taken, and one of the  works 
we read in American Literature was Edgar Allan Poe's &lt;em&gt;&lt;a 
href="http://xroads.virginia.edu/~HYPER/poe/composition.html"&gt;The Philosophy of 
Composition&lt;/a&gt;&lt;/em&gt;.
&lt;p&gt;&lt;h2&gt;Code As Poetry&lt;/h2&gt;
&lt;p&gt;In &lt;em&gt;The Philosophy of Composition&lt;/em&gt;, Poe attempts to describe exactly 
how he composed &lt;a href="http://www.eapoe.org/works/poems/ravent.htm"&gt;The 
Raven&lt;/a&gt;, simply because he's never seen such an attempt before. While we 
might be wise to doubt his motives (as did &lt;a 
href="http://books.google.com/books?id=c3l3ldtUz2EC&amp;pg=PA33&amp;lpg=PA33&amp;dq=%22it+is+difficult+for+us+to+read+that+essay+without+reflecting%22&amp;source=web&amp;ots=hR5I--IYLA&amp;sig=84W7hAjUnNYNDAddaBW3HvtGsrk"&gt;TS  
Eliot&lt;/a&gt;), it nevertheless may be interpreted to provide solid principles for 
the construction of a program.
&lt;p&gt;Before we do so, I must first convince you that code should be read as 
poetry instead of prose. Since this will always be a matter of opinion, and I 
know that many people will disagree, my argument will be short and simple.
&lt;p&gt;When you read prose, you read it as if it is being narrated to you; whether 
by a narrator, a character in the story, or many characters, the distinguishing 
characteristic of prose is its similarity to speech. We find that it is allowed 
a much greater freedom of verbosity, so long as it accomplishes its goal of 
conveying a plot to its reader.
&lt;p&gt;Poetry, on the other hand, is an abstract block of words in which every one 
must carry meaning if the poem is to be any good. We value the poem for the 
beauty not only of the story or image given, but of the way in which it is 
constructed as well. It tends to be much denser and more compact than prose.  
When you read it, you must proceed carefully and consider the meaning of each 
word, and each group of words, and pay attention for double meanings and 
allusions if you are to grasp it fully.
&lt;p&gt;To help us decide how we read code, let's go to a &lt;a 
href="http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html#%_idx_730"&gt;particularly 
nice bit&lt;/a&gt; of it, and meditate on it for a moment. Did you read it as if it 
were speech, or poetry? Did it have a narrative "flow" for you, or was it 
something of an abstract block of "words"?
&lt;p&gt;Of course, code is really neither prose nor poetry; it is a distinct art 
form of which Poe could not have been aware. I like to think that it may be 
read much more closely to poetry than to prose, and we will proceed from here 
as if this were true.
&lt;p&gt;&lt;h2&gt;Unity of Impression&lt;/h2&gt;
&lt;blockquote&gt;If any literary work is too long to be read at one sitting, we must 
be content to dispense with the immensely important effect derivable from unity 
of impression- for, if two sittings be required, the affairs of the world 
interfere, and everything like totality is at once destroyed. But since, 
ceteris paribus, no poet can afford to dispense with anything that may advance 
his design, it but remains to be seen whether there is, in extent, any 
advantage to counterbalance the loss of unity which attends it. Here I say no, 
at once. What we term a long poem is, in fact, merely a succession of brief 
ones- that is to say, of brief poetical effects. It is needless to demonstrate 
that a poem is such only inasmuch as it intensely excites, by elevating the 
soul; and all intense excitements are, through a psychal necessity, brief. For 
this reason, at least, one-half of the &lt;em&gt;Paradise Lost&lt;/em&gt; is essentially 
prose- a succession of poetical excitements interspersed, inevitably, with 
corresponding depressions- the whole being deprived, through the extremeness of 
its length, of the vastly important artistic element, totality, or unity of 
effect.&lt;/blockquote&gt;
&lt;p&gt;In the first sentence of this paragraph, Poe provides an alternate metric to 
&lt;a href="http://steve-yegge.blogspot.com/2007/12/codes-worst-enemy.html"&gt;Yegge's&lt;/a&gt; 
metric of "code size" - that of "unity of impression". Beautiful code is that 
which is not composed of "a succession of brief.. poetical effects", but of 
just the poem. It is code without filler, bureaucracy, or artifice, regardless 
of how long it is.
&lt;p&gt;As a practical matter, not all programs may be written in this manner. In an 
&lt;a href="http://fxr.watson.org/fxr/source/kern/imgact_elf.c"&gt;operating system 
kernel&lt;/a&gt;, a great deal of "corresponding depressions" &amp;mdash; documentation, 
error handling, and interrupt handling &amp;mdash; must be interspersed in between 
the "poetical effects", making it "essentially prose".
&lt;p&gt;This does not change the fact that the Linux kernel or a BSD kernel is a 
thing of beauty, just as &lt;em&gt;Paradise Lost&lt;/em&gt; is great despite "the 
extremeness of its length". Instead, it should give us motivation for our 
programs, to write them with as few depressions as possible so as not to drag 
down their unity of impression.
&lt;p&gt;A great example of code as poetry is OpenBSD's &lt;a 
href="http://ftp.bg.openbsd.org/OpenBSD/src/usr.bin/tail/"&gt;tail&lt;/a&gt;&lt;sup&gt;&lt;a 
href="#footnote1"&gt;1&lt;/a&gt;&lt;/sup&gt;, which I referenced in a &lt;a 
href="http://billmill.org/reversefile.html"&gt;previous post&lt;/a&gt;. After I sat down 
with it for an hour, it was extremely clear to me what it did. In the &lt;a 
href="http://ftp.bg.openbsd.org/OpenBSD/src/usr.bin/tail/tail.c"&gt;beginning&lt;/a&gt;, 
it set out the patterns of code which would continue throughout, enabling me to 
quickly find my way to &lt;a 
href="http://ftp.bg.openbsd.org/OpenBSD/src/usr.bin/tail/reverse.c"&gt;the part 
that mattered&lt;/a&gt;, despite my relative unfamiliarity with C.
&lt;p&gt;It is a great strength of the Unix philosophy that each bit of code may be 
kept as brief, self-contained, unified, and therefore beautiful. It is a 
pleasure to work with tools which have been pared down to their bare bits 
instead of expanded to encompass ever more functionality.
&lt;p&gt;&lt;h2&gt;Design for a Purpose&lt;/h2&gt;
&lt;blockquote&gt;My next thought concerned the choice of an impression, or effect, 
to be conveyed: and here I may as well observe that throughout the 
construction, I kept steadily in view the design of rendering the work 
universally appreciable. I should be carried too far out of my immediate topic 
were I to demonstrate a point upon which I have repeatedly insisted, and which, 
with the poetical, stands not in the slightest need of demonstration- the 
point, I mean, that Beauty is the sole legitimate province of the 
poem.&lt;/blockquote&gt;
&lt;p&gt;If beauty is the sole province of poetry, I propose that data transformation 
is the sole province of the computer program. (I am not the first to do, 
although I cannot recall where I read it first). Therefore, when designing a 
program, we should at all times keep in mind the transformation which we wish 
to achieve, and discard all those parts which do not assist in that goal.
&lt;p&gt;While this seems at first straightforward, it is important to consider that 
programs are designed for humans and by humans. Unlike poetry, most code is not 
generated by its author for the appreciation of the masses. Instead, it is 
designed to fulfill a purpose, specifically to achieve a certain data 
transformation. 
&lt;p&gt;Just as very few great poems were authored by multiple people, very few 
great programs have been authored by multiple people. If we consider long 
programs to be composed of many poems separated by dull bits, their great parts 
are almost exclusively those parts over which their maintainers have slaved to 
bring to a state of terse beauty.
&lt;p&gt;If you must have many people working on a program, it is of the utmost 
importance that they all know and share an understanding of what 
&lt;em&gt;exactly&lt;/em&gt; it is that the program is intended to accomplish. Without this 
deep shared knowledge of intent, the program will lack a single impression, or 
effect, to be conveyed, and likely fail to impress.
&lt;p&gt;&lt;h2&gt;All The Rest&lt;/h2&gt;
&lt;blockquote&gt;The length, the province, and the tone, being thus determined, I 
betook myself to ordinary induction&lt;/blockquote&gt;
&lt;p&gt;Once you have determined the length, purpose, and tone of your program, the 
rest is, as they say, trivial. Poe dedicates the rest of his essay to applying 
the principles discussed in this essay, and showing how "The Raven" falls ever 
so simply out of them. If you write a program while at all times keeping in 
mind its unity of purpose and the impression you intend to convey, perhaps you 
will find some beauty in it.
&lt;p&gt;I hope that you will read the &lt;a 
href="http://xroads.virginia.edu/~HYPER/poe/composition.html"&gt;essay&lt;/a&gt; in its 
entirety; I'm sure that I have failed to do it justice here. Although it is of 
questionable merit as a method of writing the next "The Raven", perhaps it will 
help you think about how to write your next program.
&lt;p&gt;&lt;div id="footnote"&gt;&lt;h2&gt;Notes&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; &lt;a name="footnote1"&gt;&lt;a 
href="http://pyblosxom.svn.sourceforge.net/viewvc/pyblosxom/trunk/pyblosxom/Pyblosxom/"&gt;pybloxsom&lt;/a&gt; 
is another, and reddit readers &lt;a 
href="http://programming.reddit.com/info/63hth/comments/"&gt;provide many 
more&lt;/a&gt;.
</summary>
		<content type="html">One of the strongest influences on my programming has always been an essay I 
read in my sophomore year of high school, around about the same time I began to 
feel the magic of programming. Mr. Carino was a young man just out of college, 
a &lt;a href="http://en.wikipedia.org/wiki/Slayer"&gt;Slayer&lt;/a&gt; fan and ardent Twain 
admirer, and a man who would disappear mysteriously a year later. That year, 
though, he gave the most electric class I've ever taken, and one of the  works 
we read in American Literature was Edgar Allan Poe's &lt;em&gt;&lt;a 
href="http://xroads.virginia.edu/~HYPER/poe/composition.html"&gt;The Philosophy of 
Composition&lt;/a&gt;&lt;/em&gt;.
&lt;p&gt;&lt;h2&gt;Code As Poetry&lt;/h2&gt;
&lt;p&gt;In &lt;em&gt;The Philosophy of Composition&lt;/em&gt;, Poe attempts to describe exactly 
how he composed &lt;a href="http://www.eapoe.org/works/poems/ravent.htm"&gt;The 
Raven&lt;/a&gt;, simply because he's never seen such an attempt before. While we 
might be wise to doubt his motives (as did &lt;a 
href="http://books.google.com/books?id=c3l3ldtUz2EC&amp;pg=PA33&amp;lpg=PA33&amp;dq=%22it+is+difficult+for+us+to+read+that+essay+without+reflecting%22&amp;source=web&amp;ots=hR5I--IYLA&amp;sig=84W7hAjUnNYNDAddaBW3HvtGsrk"&gt;TS  
Eliot&lt;/a&gt;), it nevertheless may be interpreted to provide solid principles for 
the construction of a program.
&lt;p&gt;Before we do so, I must first convince you that code should be read as 
poetry instead of prose. Since this will always be a matter of opinion, and I 
know that many people will disagree, my argument will be short and simple.
&lt;p&gt;When you read prose, you read it as if it is being narrated to you; whether 
by a narrator, a character in the story, or many characters, the distinguishing 
characteristic of prose is its similarity to speech. We find that it is allowed 
a much greater freedom of verbosity, so long as it accomplishes its goal of 
conveying a plot to its reader.
&lt;p&gt;Poetry, on the other hand, is an abstract block of words in which every one 
must carry meaning if the poem is to be any good. We value the poem for the 
beauty not only of the story or image given, but of the way in which it is 
constructed as well. It tends to be much denser and more compact than prose.  
When you read it, you must proceed carefully and consider the meaning of each 
word, and each group of words, and pay attention for double meanings and 
allusions if you are to grasp it fully.
&lt;p&gt;To help us decide how we read code, let's go to a &lt;a 
href="http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html#%_idx_730"&gt;particularly 
nice bit&lt;/a&gt; of it, and meditate on it for a moment. Did you read it as if it 
were speech, or poetry? Did it have a narrative "flow" for you, or was it 
something of an abstract block of "words"?
&lt;p&gt;Of course, code is really neither prose nor poetry; it is a distinct art 
form of which Poe could not have been aware. I like to think that it may be 
read much more closely to poetry than to prose, and we will proceed from here 
as if this were true.
&lt;p&gt;&lt;h2&gt;Unity of Impression&lt;/h2&gt;
&lt;blockquote&gt;If any literary work is too long to be read at one sitting, we must 
be content to dispense with the immensely important effect derivable from unity 
of impression- for, if two sittings be required, the affairs of the world 
interfere, and everything like totality is at once destroyed. But since, 
ceteris paribus, no poet can afford to dispense with anything that may advance 
his design, it but remains to be seen whether there is, in extent, any 
advantage to counterbalance the loss of unity which attends it. Here I say no, 
at once. What we term a long poem is, in fact, merely a succession of brief 
ones- that is to say, of brief poetical effects. It is needless to demonstrate 
that a poem is such only inasmuch as it intensely excites, by elevating the 
soul; and all intense excitements are, through a psychal necessity, brief. For 
this reason, at least, one-half of the &lt;em&gt;Paradise Lost&lt;/em&gt; is essentially 
prose- a succession of poetical excitements interspersed, inevitably, with 
corresponding depressions- the whole being deprived, through the extremeness of 
its length, of the vastly important artistic element, totality, or unity of 
effect.&lt;/blockquote&gt;
&lt;p&gt;In the first sentence of this paragraph, Poe provides an alternate metric to 
&lt;a href="http://steve-yegge.blogspot.com/2007/12/codes-worst-enemy.html"&gt;Yegge's&lt;/a&gt; 
metric of "code size" - that of "unity of impression". Beautiful code is that 
which is not composed of "a succession of brief.. poetical effects", but of 
just the poem. It is code without filler, bureaucracy, or artifice, regardless 
of how long it is.
&lt;p&gt;As a practical matter, not all programs may be written in this manner. In an 
&lt;a href="http://fxr.watson.org/fxr/source/kern/imgact_elf.c"&gt;operating system 
kernel&lt;/a&gt;, a great deal of "corresponding depressions" &amp;mdash; documentation, 
error handling, and interrupt handling &amp;mdash; must be interspersed in between 
the "poetical effects", making it "essentially prose".
&lt;p&gt;This does not change the fact that the Linux kernel or a BSD kernel is a 
thing of beauty, just as &lt;em&gt;Paradise Lost&lt;/em&gt; is great despite "the 
extremeness of its length". Instead, it should give us motivation for our 
programs, to write them with as few depressions as possible so as not to drag 
down their unity of impression.
&lt;p&gt;A great example of code as poetry is OpenBSD's &lt;a 
href="http://ftp.bg.openbsd.org/OpenBSD/src/usr.bin/tail/"&gt;tail&lt;/a&gt;&lt;sup&gt;&lt;a 
href="#footnote1"&gt;1&lt;/a&gt;&lt;/sup&gt;, which I referenced in a &lt;a 
href="http://billmill.org/reversefile.html"&gt;previous post&lt;/a&gt;. After I sat down 
with it for an hour, it was extremely clear to me what it did. In the &lt;a 
href="http://ftp.bg.openbsd.org/OpenBSD/src/usr.bin/tail/tail.c"&gt;beginning&lt;/a&gt;, 
it set out the patterns of code which would continue throughout, enabling me to 
quickly find my way to &lt;a 
href="http://ftp.bg.openbsd.org/OpenBSD/src/usr.bin/tail/reverse.c"&gt;the part 
that mattered&lt;/a&gt;, despite my relative unfamiliarity with C.
&lt;p&gt;It is a great strength of the Unix philosophy that each bit of code may be 
kept as brief, self-contained, unified, and therefore beautiful. It is a 
pleasure to work with tools which have been pared down to their bare bits 
instead of expanded to encompass ever more functionality.
&lt;p&gt;&lt;h2&gt;Design for a Purpose&lt;/h2&gt;
&lt;blockquote&gt;My next thought concerned the choice of an impression, or effect, 
to be conveyed: and here I may as well observe that throughout the 
construction, I kept steadily in view the design of rendering the work 
universally appreciable. I should be carried too far out of my immediate topic 
were I to demonstrate a point upon which I have repeatedly insisted, and which, 
with the poetical, stands not in the slightest need of demonstration- the 
point, I mean, that Beauty is the sole legitimate province of the 
poem.&lt;/blockquote&gt;
&lt;p&gt;If beauty is the sole province of poetry, I propose that data transformation 
is the sole province of the computer program. (I am not the first to do, 
although I cannot recall where I read it first). Therefore, when designing a 
program, we should at all times keep in mind the transformation which we wish 
to achieve, and discard all those parts which do not assist in that goal.
&lt;p&gt;While this seems at first straightforward, it is important to consider that 
programs are designed for humans and by humans. Unlike poetry, most code is not 
generated by its author for the appreciation of the masses. Instead, it is 
designed to fulfill a purpose, specifically to achieve a certain data 
transformation. 
&lt;p&gt;Just as very few great poems were authored by multiple people, very few 
great programs have been authored by multiple people. If we consider long 
programs to be composed of many poems separated by dull bits, their great parts 
are almost exclusively those parts over which their maintainers have slaved to 
bring to a state of terse beauty.
&lt;p&gt;If you must have many people working on a program, it is of the utmost 
importance that they all know and share an understanding of what 
&lt;em&gt;exactly&lt;/em&gt; it is that the program is intended to accomplish. Without this 
deep shared knowledge of intent, the program will lack a single impression, or 
effect, to be conveyed, and likely fail to impress.
&lt;p&gt;&lt;h2&gt;All The Rest&lt;/h2&gt;
&lt;blockquote&gt;The length, the province, and the tone, being thus determined, I 
betook myself to ordinary induction&lt;/blockquote&gt;
&lt;p&gt;Once you have determined the length, purpose, and tone of your program, the 
rest is, as they say, trivial. Poe dedicates the rest of his essay to applying 
the principles discussed in this essay, and showing how "The Raven" falls ever 
so simply out of them. If you write a program while at all times keeping in 
mind its unity of purpose and the impression you intend to convey, perhaps you 
will find some beauty in it.
&lt;p&gt;I hope that you will read the &lt;a 
href="http://xroads.virginia.edu/~HYPER/poe/composition.html"&gt;essay&lt;/a&gt; in its 
entirety; I'm sure that I have failed to do it justice here. Although it is of 
questionable merit as a method of writing the next "The Raven", perhaps it will 
help you think about how to write your next program.
&lt;p&gt;&lt;div id="footnote"&gt;&lt;h2&gt;Notes&lt;/h2&gt;&lt;/div&gt;
&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; &lt;a name="footnote1"&gt;&lt;a 
href="http://pyblosxom.svn.sourceforge.net/viewvc/pyblosxom/trunk/pyblosxom/Pyblosxom/"&gt;pybloxsom&lt;/a&gt; 
is another, and reddit readers &lt;a 
href="http://programming.reddit.com/info/63hth/comments/"&gt;provide many 
more&lt;/a&gt;.
</content>
	</entry>
</feed>
