Unfortunately, moral beauty in art—like physical beauty in a person—is extremely perishable 🌹
~ Susan Sontag
Programs must be written for people to read, and only incidentally for machines to execute 🎼
~ Harold Abelson and Gerald (Structure and Interpretation of Computer Programs, Second Edition, The MIT Press)
In literature, the ambition of the novice is to acquire the literary language; the struggle of the adept is to get rid of it 📘
~ George Bernard Shaw
Is it possible that software is not like anything else, that it is meant to be discarded: that the whole point is to always see it as a soap bubble? 👻
~ Alan J. Perlis
Why hast thou not the visage of a sweetie or a cutie?
Why glitter thy spectacles so ominously?
Why art thou clad so abominously?
Why art thou so different from Venus
And why do thou and I have so few interests mutually in common between us?
Why art thou fifty per cent martyr
And fifty-one per cent Tartar?
Mathematics, rightly viewed, possesses not only truth, but supreme beauty—a beauty cold and austere, like that of sculpture, without appeal to any part of our weaker nature, without the gorgeous trappings of painting or music, yet sublimely pure, and capable of a stern perfection such as only the greatest art can show. The true spirit of delight, the exaltation, the sense of being more than Man, which is the touchstone of the highest excellence, is to be found in mathematics as surely as poetry (italics mine).
Peter Seibel is either a writer-turned-programmer or a programmer-turned-writer. After picking up an undergraduate degree in English and working briefly as a journalist, he was seduced by the Web…
My basic premise is that there exists a profound nexus between (software) code and prose: While the English language, or any other spoken language, for that matter, is clearly not Turing complete—I’ve heard, though, that COBOL occupied a fabled place somewhere between spoken and programming languages 🙉—the simple fact is that rewriting (spoken languages) maps directly to the programming notion of refactoring, which its originator, Martin Fowler, describes succinctly as
a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior.
I have never thought of myself as a good writer. Anyone who wants reassurance of that should read one of my first drafts. But I’m one of the world’s greatest rewriters.
And there you have humbleness and greatness, all rolled into one 😎
In returning from the segue, and while still exploring the profound nexus between software code and prose, I’ll add that software design patterns are a first class attempt at reclaiming the beauty that may otherwise languish due to neglect and bit rot. This, too, has a direct counterpart in the crafting of prose; for more, I refer the interested reader to Professor John Trimble’s Writing with Style: Conversations on the Art of Writing.
Allow me to wedge in here, edgewise, the factoid that probably the preeminent tome on modern American usage—now in its fourth edition—is by yet another individual who cares as much about their art (the practice of law), as they do for the writing craft: Bryan Garner. His magisterial volume, simply entitled Garner’s Modern American Usage (Oxford University Press), was received to wide acclaim, and for good reason; it simply happens to be one of those overwhelmingly rich yet can’t-put-me-down volumes 💯 A polymath of sorts, Garner has been recognized as a pioneer across a wide range of fields, including English usage, grammar, jurisprudence, legal advocacy, and is the president of the company—note here the marriage-made-in-heaven name—LawProse Inc. 🎩
The first rule of my personal programming style has always been the following:
Write beautiful code. I’ve achieved this goal to varying degrees of success throughout my career, but it’s always something that I strive for. Writing beautiful code allows me to optimize another aspect of computer time: the time that I spend sitting at a desk typing on a keyboard. I find a functional style of writing code to be exceptionally beautiful if done well, and I hope that you’ll agree by the time you reach the end (italics mine).
In fact, functions are a beautiful unit of work allowing you to adhere to the long-practiced maxim in the UNIX community, set forth by Butler Lampson:
Make it run, make it right, make it fast 🐢
Likewise, functions-as-abstraction allow you to fulfill Kent Beck’s similarly phrased mantra of test-driven development (TDD):
Make it run, then make it right, then make it fast 🐎
Most software development efforts require pragmatism, though, and fortunately for us Fogus tackles this important requirement as well. Having beautiful, sophisticated and simple code is ultimately meaningless if it’s not practical, and this is a large part of the reason functional programming stayed hidden in the shadows for so many years. Fogus addresses this issue by helping the reader explore and evaluate the computing costs associated with the functional programming approaches he champions here.
And of course books, just like software, are ultimately about communication. Like Crockford, Fogus writes in a manner that’s both brief and informative, saying just enough to drive his ideas home without belaboring them. I can’t overstate the importance of Michael’s brevity and clarity, since without them we’d miss the incredible potential of the ideas and insights he’s provided here. You’ll find elegance not only in the approaches and code Fogus presents, but also in the way he presents them (italics mine).
Let’s next turn our attention to the pursuit of beauty in the Pulitzer Prize-winning book Gödel, Escher, Bach: An Eternal Golden Braid whose author, Douglas Hofstadter, astonished the world with the publication of this mind-bending fugue of a book. This book’s monumental impact was perhaps best heralded by the American popular mathematics and popular science writer Martin Gardner who elegantly summed it up by noting that
Every few decades an unknown author brings out a book of such depth, clarity, range, wit, beauty and originality that it is recognized at once as a major literary event. ‘Godel, Bach’ is such a work (italics mine).
Finally, in laying to rest the thread we had picked up earlier—how individuals can care as much about their art as they do for the craft of writing well—let’s check out an excerpt or two from the almost-sublime prose of an author whose name is quite possibly alien to the majority of my fellow software designers and developers, though I may be pleasantly mistaken in my assumption 😂 Allow me to introduce Philip M. Bromberg, Ph.D, by way of this review of his book Awakening the Dreamer, by Richard A. Chefetz, M.D. who cuts to the heart of the matter in reflecting on the vista-opening power and beauty in Bromberg’s prose by noting that
Whether the wish is to know oneself more deeply, to understand better the psychoanalytic process, or simply to immerse oneself in seamless, elegant prose, Philip Bromberg’s Awakening the Dreamer is enormously satisfying. Besides showing that the analyst’s thoughtful self-revelation is not simply permissible, but actually necessary in the analytic process, Bromberg makes salient connections between leading-edge work in affective neuroscience and the relational psychoanalytic tradition he helped create. A nearly effortless read, Dreamer places the reader inside the minds both of a master clinician and of his patient (italics mine).
Consider the following lines written by Carlos Ruiz Zafon (2001) in his novel, The Shadow of the Wind. Daniel, the protagonist, is suddenly reunited with the most deeply important friend of his childhood, and in the reunion he relives the birth of that friendship:
It seemed to me that this oversize, solitary boy had constructed his own tin companions and that I was the first person he was introducing them to. It was his secret. I shared mine. I told him about my mother and how much I missed her. When my voice broke, Tomas hugged me without saying a word. We were ten years old. From that day on Tomas Aguilar became my best—and I his only—friend. (p. 94, emphasis added)
Through Zafon’s brilliant placement of the two em-dashes in the final sentence, he endows “best” and “only” with linguistic unity, and in so doing he evocatively endows the word “friend” with experiential wholeness that transcends our cognitive awareness of each boy’s individuality. Even though each adjective remains unique to the personality of just one of the boys, the relational oneness of that friendship is felt as greater than the sum of its parts. The author could have written “Tomas Aguilar became my best friend, and I his only friend” but if he had, separateness would replace oneness; the way Zafon uses language pulls the reader not only into the book but into himself. Individuality and oneness become a single entity in the act of reunion.
Next, I have the pleasure of mentioning two other leading thinkers and writers: Elizabeth Saunders and Cal Newport. I mention them in the same breath because it was through the writings of the latter that I was introduced to the writings of the former 🎯 I have reviewed Elizabeth’s books elsewhere and they are hands down the final word on time management ⏰ Briefly, along with another book—the remarkable tome Probability Theory: The Logic of Science, by E. T. Jaynes (Cambridge University Press)—I had reviewed Elizabeth’s second book, entitled How to Invest Your Time Like Money (Harvard Business Review Press), noting how
…just when you thought that Elizabeth had shared all imaginable wisdom on the subject of time investment, she comes back with yet another tour de force of a book. What had amazed me about her first book—The 3 Secrets to Effective Time Investment—was that I could randomly open the book to any page, and be guaranteed a nugget of wisdom. Just to make sure the magic was still working 😉 I opened the book randomly to the page which leads off a discussion (entitled Routines Require Intentional Practice), and found this insight that I’m partially excerpting here:
At first it will take a great deal of mental and emotional fortitude to even want to start putting these routines into practice…. It’s like hacking a new pathway through the jungle of the day when you were used to strolling down a well-established trail or like breaking up scar tissue and retraining your muscles when your body developed bad compensation techniques after an injury…. Ultimately, though, strengthening simple routines leads to a life where you consistently achieve more success with less stress.
This stellar follow-up book—How to Invest Your Time Like Money—is every bit as good.
As for the second of these two leading thinkers, Cal Newport, I have previously shared my perspective on his work in an essay entitled Top Thought Leaders to Follow, starting with the preamble that
At the top of my list is Cal Newport, who is just about the most clear-eyed thinker I know of. Cal teaches at Georgetown University in Washington, D.C, where he is an Assistant Professor of Computer Science. What’s unique about Cal are his uniquely original insights, which he shares with the world through his Study Hacks Blog—Decoding Patterns of Success. As the name of his blog signals, his posts seek to capture the essence of achieving meaningful success through wide-ranging, engagingly written, and eminently thought-provoking discussions.
Even more relevant to our present theme, Cal had this to say, in his slim and stellar book entitled How to Win at College: Surprising Secrets for Success from the Country’s Top Students 🎓 (Broadway Books), on the craft of writing, as should be practiced in daily life. Thus, in a chapter in that book, with the delightfully evocative title Write as if Going for a Pulitzer, he reminds us how
Good writing sparkles, not just in content but also in form. When you read good writing, the varied rhythm of the sentences, the careful choice of words, and the descriptive phrases grab your attention and pull you through the topic toward inevitable conclusions. The experience is almost cinematic. You lose yourself in the prose and come out on the last page feeling as if you just experienced something significant. This is how you should aspire to write. A student who goes beyond just demonstrating coherent knowledge of a subject, and also artfully crafts the delivery, is going to stand out among his or her peers. Professors’ eyes will light up, your name will be remembered, and you will score consistently higher on your written assignments (italics mine).
Here you have the indelible imprints of someone caring for the craft of writing that is all at once suffused with pragmatism 🔦
Let’s next turn to what English poet and playwright William Shakespeare, widely regarded as the greatest writer in the English language and the world’s pre-eminent dramatist, had to say on beauty, by way of this monologue, spoken in the play by Prince Hamlet 📖 And Shakespeare certainly had a way with words; here he has angst-ridden Hamlet ruefully ponder over
What a piece of work is a man! How noble in reason! How infinite in faculties! In form and moving, how express and admirable! In action how like an angel!
In apprehension, how like a god! The beauty of the world! The paragon of animals! And yet, to me, what is this quintessence of dust? (italics mine)
As a postscript to the thread—this time drilling down to the level of the irreducible atoms that form the very substrate of both code and prose—let’s take a peek at the nexus between thought, words, prose, and code, the latter being the distillation of someone’s attempt to reify the conceptualization of a process. So here is Donnel B. Stern, writing with his trademark and uncommonly clear formulations, as he observes in his book, Unformulated Experience (Routledge), how
Merleau-Ponty (1964b) distinguishes “empirical speech,” the established usage of conventional expressions, from “creative speech,” which “frees the meaning captive in the thing.” “To speak,” he says about authentic speech, “is not to put a word under each thought…”
We sometimes have, on the contrary, the feeling that a thought has been spoken—not replaced by verbal counters but incorporated in words and made available in them” (p. 44). He goes on to discuss the creative use of language this way: “Language signifies when instead of copying thought it lets itself be taken apart and put together again by thought. Language bears the meaning of thought as a footprint signifies the movement and effort of a body” (p. 44). And earlier (1964a), he tells us that speech
tears out or tears apart meanings in the undivided whole of the nameable, as our gestures do in that of the perceptible. To make of language a means or a code for thought is to break it. When we do so we prohibit ourselves from understanding the depth to which words sound within us—from understanding that we have a need, a passion, for speaking and must (as soon as we think) speak to ourselves; that words have the power to arouse thoughts and implant henceforth inalienable dimensions of thought; and that they put responses on our lips we did not know we were capable of, teaching us, Sartre says, our own thought [p. 17].
This is hardly a vision of language as passive, docile, or merely categorical. It is instead apocalytic, intuitive, antic, possessed. Language is no servant; it is disobedient and revelatory. Language is a dervish. It belongs to us and it carries us away, all in the same instant.
This is precisely the sort of riveting prose that knocks my socks off; the inseparable entanglement with the irreducible atoms which are the bedrock of code and prose; and another reason—perhaps, the reason—why designing and crafting software code and prose are inextricably woven into a unified tapestry which, at its finest, drive many of us, software designers, and others, to be sure, in these pursuits 🐬
Merleau-Ponty, M. (1964a), Introduction. In: Signs, trans. R. C. McCleary. Evanston, IL: Northwestern University Press, pp. 3-35.
Merleau-Ponty, M. (1964b), Indirect language and the voices of silence. In: Signs, trans. R. C. McCleary. Evanston, IL. Northwestern University Press, pp. 39-97.
And this is precisely what the brilliant English novelist, essayist, journalist, and critic George Orwell had in mind when he alerted us, in a justifiably admonitory tone, in his prescient essay Politics and the English Language regarding how
As I have tried to show, modern writing at its worst does not consist in picking out words for the sake of their meaning and inventing images in order to make the meaning clearer. It consists in gumming together long strips of words which have already been set in order by someone else, and making the results presentable by sheer humbug.
I used the phrase “riveting prose” above, and it relentlessly ushers in a flood of memories, this being a phrase which I first came across in the pages of a stellar book that has had, by far, the greatest impact on my writing: Writing with Style: Conversations on the Art of Writing, by John Trimble. In fact, you can find a notable mention in a prior essay here on my blog, noting in that essay that
When Graham’s Hackers & Painters came out, many years ago (it predates my reading any of his works on Lisp), I was so impressed by its quality that I wrote to him, telling him how highly I thought of his book, plus recommending to him the best book available on this planet on writing well, namely Writing with Style: Conversations on the Art of Writing by John R. Trimble. Graham graciously replied to me, saying that he in fact had a copy of Writing with Style in his bookshelf. I was pleasantly surprised, because while most everyone has heard of The Elements of Style (by Strunk and White), hardly anyone is even aware of John R. Trimble’s stellar gem of a book. In my mind at least, and with all due respect to the former book (because I have read and appreciated its advice), Writing with Style is the book that The Elements of Style wants to be when it grows up 👻
If you take away from this essay only one book, please make it Writing with Style: Conversations on the Art of Writing by John R. Trimble. I refer to the volume fondly as WWS. My writing life can be cleanly divided—much as the World Wars (WW) divided history into pre- and post-WW—into pre- and post-WWS 🚑 Here is Professor Trimble, gently reminding us in WWW how
The average college student isn’t ready for semicolons. She hasn’t discerned any need for them, nor is she eager to. They look forbiddingly exotic—about as tempting as a plate of snails 🐌
Enough said. And yes, I got smitten by the pixie-dust magic qualities 💥 of em-dashes, which I alluded to earlier, directly as a result of reading Professor Trimble’s classic and ever-sparkling WWW. While on the subject, allow me to share merely a single excerpt, and a single sentence at that, from the works of one of the most elegant and precise writers of the world, the British mathematician and philosopher Bertrand Russell. As I share this, I can’t help but pause and reflect on the current affairs of our world today, and the irony of it all as Russell looked to “men who were deeply imbued with a respect for law”. He noted, in “Individual and Social Ethics” in The Basic Writings of Bertrand Russell (1961), how
It is noteworthy that the most successful revolutions—that of England in 1688 and that of America in 1776—were carried out by men who were deeply imbued with a respect for law.
Prose doesn’t get any more elegant, refined, and poignant than that, does it? 🏰 And to really get these lovely interlopes, these em-dashes, out of my system, let’s together look at what lawyer and prose-pro Bryan Garner, whom we met earlier, has to say about them in his magisterial volume entitled Garner’s Modern American Usage (Oxford University Press)
The em-dash is perhaps the most underused punctuation mark in American writing. Whatever the type of writing, dashes can often clarify a sentence that is clogged up with commas—or even one that’s otherwise lusterless… 🎯
My well-worn (paperback) copy of Writing with Style: Conversations on the Art of Writing, literally fell apart at the seams from, shall we say, extended use; the careful reader will note the spiral-bound copy toward the right-hand side in the pic above.
So I got to thinking about something that the noted Lisp hacker—and founder of Y Combinator, now the preeminent startup-company accelerator—Paul Graham had to say in connection with the pursuit of beauty in design. So I dug up my well-worn copy of Hackers & Painters (O’Reilly Media), harking back to my days in wintry Minnesota ⛄ and boy, was I surprised, pleasantly so, I hasten to add, to rediscover, in revisiting its pages, just how profound and lasting an impact the pursuit of beauty has in creating and evolving designs of the highest order. To give you a better flavor of Graham’s take on this subtle matter, I really can’t do much better than share some excerpts as I flip through the well-worn (wizened? although using this latter word would be a tad too anthropomorphic) pages of Hackers & Painters…
But first, some clarification of the term hacker—in the sense that in which it’s used here—is in order:
A hacker is any skilled computer expert that uses their technical knowledge to overcome a problem… 📖
With that slight digression—a definitional one—out of the way, let’s hear Graham’s profound musings on what it might mean to pursue beauty in the quest for creating and evolving (software) designs of the highest order. He notes that
Measuring what hackers are actually trying to do, designing beautiful software, would be much more difficult. You need a good sense of design to judge good design. And there is no correlation, except possibly a negative one, between people’s ability to recognize good design and their confidence that they can.
The only external test is time. Over time, beautiful things tend to thrive, and ugly things tend to get discarded. Unfortunately, the amounts of time involved can be longer than human lifetimes. Samuel Johnson said it took a hundred years for a writer’s reputation to converge. You have to wait for the writer’s influential friends to die, and then for all their followers to die (italics mine).
And here is Graham again, writing this time on a more personal note—but with his trademark perspicacity and perspicuity—elsewhere in the book, reflecting on his high school days, observing that
There was something else I wanted more: to be smart. Not simply to do well in school, though that counted for something, but to design beautiful rockets, or to write well, or to understand how to program computers. In general, to make great things.
Yes, there seem to exist far more than mere tenuous links between beauty and great software and prose, dare I say 🚀 Come to think of it, the notion of beauty as a guiding principle to crafting great software—and prose, to be sure—has spawned an entire series of books on the pragmatic unity of beauty and technology, brought to us by the publishing industry’s vanguard company we all fondly know as OReilly. Here is the basis of the theme, nicely articulated by the editors (Diomidis Spinellis and Georgios Gousios) of the book Beautiful Architecture (O’Reilly). They note in the Preface that
The idea for the book you’re reading was conceived in 2007 as a successor to the award-winning, best-selling Beautiful Code: a collection of essays about innovative and sometimes surprising solutions to programming problems. In Beautiful Architecture, the scope and purpose is different, but similarly focused: to get leading software designers and architects to describe a software architecture of their choice, peeling back the layers of their creations to show how they developed software that is functional, reliable, usable, efficient, maintainable, portable, and, yes, elegant.
And this is how Greg Wilson and Andy Oram, the editors of another book in this series, entitled Beautiful Code, tell the reader in the Foreword to the book how
In May 2006, I asked some well-known (and not so well-known) software designers to dissect and discuss the most beautiful piece of code they knew. As this book shows, they have found beauty in many different places. For some, it lives in the small details of elegantly crafted software. Others find beauty in the big picture—in how a program’s structure allows it to evolve gracefully over time, or in the techniques used to build it (italics mine).
Finally, in wrapping up our brief exploration of how beauty can serve as an unerring guiding principle to crafting great software, glancing as we did at some ideas captured in the series of books on the pragmatically unifying approach of pursuing beauty in mastering technology, let’s look at what the editors (Andy Oram and John Viega) of yet another book in this series have to say on this subject. This one is entitled Beautiful Security, and we are let in on how
To people tasked with creating secure systems, the effort seems hopeless. Nobody at their site cooperates with their procedures, and the business managers refuse to allocate more than a pittance to security. Jaded from the endless instances of zero-day exploits and un-patched vulnerabilities in the tools and languages they have to work with, programmers and system administrators become lax.
This is why books on security sell poorly (although in the last year or two, sales have picked up a bit). Books on hacking into systems sell much better than books about how to protect systems, a trend that really scares me.
Well, this book should change that. It will show that security is about the most exciting career you can have. It is not tedious, not bureaucratic, and not constraining. In fact, it exercises the imagination like nothing else in technology (italics mine).
There you have it, observations from the trenches of the software industry on exercising the imagination in the quest for beautiful unifying themes, weaving many strands into a unified and beautiful whole; truly, then, the whole is other than the sum of the parts.
And I haven’t even talked about beauty in the realm of those who pursue the endless frontier of artificial intelligence ⛏ Perhaps we can delve into that in a future essay. Let’s settle at this time with a quick look at what Ray Kurzweil, in his nice book How to Create a Mind: The Secret of Human Thought Revealed (Penguin Group, US), has to say in harking back to an earlier generation and asking
What is it that the later Wittgenstein thought was worth thinking and talking about? It was issues such as beauty and love, which he recognized exist imperfectly as ideas in the minds of men. However, he writes that such concepts do exist in a perfect and idealized realm, similar to the perfect “forms” that Plato wrote about in the Platonic dialogues, another work that illuminated apparently contradictory approaches to the nature of reality.
The most important result of this new depiction of the cortical hierarchy is that now we can say each and every region of cortex forms invariant representations. In the old way of thinking, we didn’t have complete invariant representations—such as faces—until inputs reached the top layer, IT, which sees the whole visual world. Now we can say that invariant representations are ubiquitous. Invariant representations are formed in every cortical region. Invariance isn’t something that only magically appears when we get to higher regions of the cortex, such as IT… Thus all regions of cortex form invariant representations of the world underneath them in the hierarchy. There is beauty in this.
Our puzzle has shifted. We no longer have to ask how invariant representations are formed in four steps from bottom to top. Rather we have to ask how invariant representations are formed in every single cortical region. This makes perfect sense if we take the existence of a common cortical algorithm seriously. If one region stores sequences of patterns, every region stores sequences. If one region creates invariant representations, all regions create invariant representations. Redrawing the cortical hierarchy along the lines shown in figure 5 makes this interpretation possible.
To this precise description of the magic and beauty of interpretations and reinterpretations I can only add some poetic leavening, by way of the words of celebrated American poet Robert Frost when he observed how
I have never started a poem yet whose end I knew. Writing a poem is discovering
In sum, this essay—entitled Beautiful Code, Beautiful Prose as it is—could just as well have been entitled Beautiful Prose, Beautiful Code. Is this juxtaposition mere semantic hair-splitting, or are we on to something more profound? Which comes first, the code or the prose? But as I hope I’ve been able to demonstrate in this essay, the two are intimately bonded to each other—like unborn twins clasped in a fraternal hug—that we might as well embrace the ineluctable conclusion that any attempt to disentangle the two (code and prose), would be a futile exercise at best, and folly at worst.
And to bring closure to the metaphor of symbiosis, no book in my mind exemplifies this theme better than Refactoring to Patterns by Joshua Kerievsky (Addison-Wesley Professional). Noted software designer Ward Cunningham had remarked about this book that “Now the connection between software patterns and agile development is finally told”. Bruce Eckel, president of Mindview, Inc., and author of the groundbreaking book Thinking in Java (Prentice Hall) went a step further in elaborating how
This book refactors and restructures GoF, and much more. Refactoring to Patterns takes a subject that has been presented as static and rigid and makes it dynamic and flexible, converting it into a human process with experiments, mistakes, and corrections so you understand that good designs do not occur by turning some series of cranks—they evolve through struggle and reflection. Kerievsky has also restructured the presentation to make it far clearer and easier to assimilate. Indeed, he has solved a number of the organization problems that I have struggled with in Thinking in Patterns. This book is a clear introduction and combination of the disciplines of testing, refactoring, and patterns, and it is filled with easy reading, good sense, and great insights (italics mine).
You got to do what you should
With each other
But we’re not the same
We get to
Carry each other
Carry each other
~ U2 (lyrics from One)
A little blue bird tells me that it’s time to wrap up. Plus I have this sinking feeling that I’ve got way more material (on this subject) than can be covered in a single essay. So if anyone is interested, by all means let me know—either here (via your blog comments) or there (by whispering in the ears of the little blue bird—and your truly will get started on a future installment of this essay to elaborate on, and delve into, any thematic aspects that grab your fancy. Deal?
With that, I leave you with this serene pic of the celebrated Fallingwater architecture, suspended as it is in glorious harmony with the surrounding foliage 🌿