Monday, August 7, 2017

Beautiful Code, Beautiful Prose

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.
~ Structure and Interpretation of Computer Programs by Harold Abelson and Gerald (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
Let's start with a simple premise: What do beautiful code and beautiful prose even look like? Even more fundamentally, are these qualities not so abstract—to the point of being ephemeral and ethereal—that even contemplating their pursuit would be akin to tilting at windmills? Clearly, there is no arbiter to pontificate and decide this matter. There are, however, some guiding principles that may fruitfully lead us down (and visualize this) a cherry-lined lane of discovery πŸ’

Humans have pursued beauty in other realms, including this noble attempt, memorably enshrined in the delightful poetry of American poet Ogden Nash, who implored the heavens, in his poem Kind of an Ode to Duty, plaintively asking why πŸ˜‰
O Duty,
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?
Consider, too, what the British mathematician and philosopher Bertrand Russell had to say on this very elemental, yet elusive, quality:
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).
To this I add the seemingly anachronistic case of this observation by top-notch writer and Lisp hacker Peter Seibel. I have written an essay elsewhere regarding how the overwhelming impression which his book Practical Common Lisp left on my mind was that it had been written by someone who cares as much about the art of programming as he does for the craft of writing well. In fact, there is an intriguing self-admission by Seibel in that book's About the Author section where we are told, tongue in cheek style, that πŸ˜†
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...
And wow, does his command of both programming and writing shine throughout the book. Picking this thread—how individuals can care as much about their art as they do for the craft of writing well—leads me to briefly unroll the ball of yarn some more. Buckle up, here we go...

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.
To segue a bit, my late father, a chemical engineer by profession, and a man of uncommon decency and integrity, was a big fan of books by the prolific American author, the late James A. Michener, widely regarded for his meticulous research behind his books. So I can think of no better way to pay tribute to and honoring the memory of them both than by sharing this delightful quote by Michener, as cited by Professor John Trimble—more on him later—in Trimble's sage book on writing style entitled Writing with Style: Conversations on the Art of Writing. In reminding us of the sobering fact that writers "...have accepted the grim reality that nine-tenths of all writing is rewriting...", Trimble cites Michener as reflecting on his own work, and sharing how
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 near-mystical Drawing Hands lithograph by M. C. Escher

Then take the case of noted language aesthete, eminent Clojure hacker, blogger, and author, Michael Fogus. In the fine volume entitled Functional JavaScript (O’Reilly), Fogus notes that
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).
Elsewhere in Functional JavaScript, Fogus reflects some more on beauty, pointing out how
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 🐎
Also in Functional JavaScript, amplifying the same theme of beauty and pragmatism, noted software architect Steve Vinoski observes (in his Foreword to the book by Fogus) that
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).
It's simply impossible to even try to contemplate doing any sort of justice to the caliber of Bromberg's prose; the best antidote is for me to share a typical passage from this prolific writer. In particular—and I have a confession to make here—as someone who is smitten by the pixie-dust magic qualities πŸ’₯ of em-dashes, I couldn't help but resonate with the impact wrought to great effect by Bromberg's use of em-dashes through the length and breadth of his seminal work. Here, in his  fine book entitled The Shadow of the Tsunami: and the Growth of the Relational Mind (Routledge), for example, he invites us to
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... 🎯
Some books fall into disuse; others into use; and yet others into overuse 🎻 My copy of this particular bookburgundy color and allfinds itself valiantly propped up against a table leg ⛳

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 hackerand founder of Y Combinator, now the preeminent startup-company acceleratorPaul 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 hackerin the sense that in which it's used hereis in order:
A hacker is any skilled computer expert that uses their technical knowledge to overcome a problem... πŸ“–

With that slight digression—a definitional oneout 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 notebut with his trademark perspicacity and perspicuityelsewhere 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 softwareand 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 otherlike 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).

One love
One blood 
One life 
You got to do what you should 
One life 
With each other 
One life 
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 🌿


  1. Thank you for an enjoyable, enlightening essay.

    1. - I appreciated very much, Bill, your making the time to read my essay, and sharing your thoughts here.
      - With this essay, I simply carried out my part, meager as it surely is, in resonating with the theme which Larry Lessig (Stanford Law School, author of Code and Other Laws of Cyberspace) had in mind when he noted that "Society has yet to understand the beauty and brilliance that wraps the coder."

    2. - Lest anyone digested my reply above (in particular the quote from noted professor at Stanford Law School, Larry Lessig) and felt any undercurrents that reminded them of Narcissus (mythological figure), let me assure you that nothing could be farther from the truth; if anything, as a computer scientist and software designer, I firmly subscribe to the philosophy of egoless programming.

      - That is a whole new topic... And as I mentioned in closing this essay (I've got way more material on this subject than can be covered in a single essay), other thematic aspects I would have liked to have covered include (1) Donald Knuth's overtures to the programming community of Literate Programming, (2) the design philosophy of one of my all-time programming heroes (Guy Steele), who is widely regarded as the father of Common Lisp and lead author of the amazing The Java Language Specification, (3) my conversations with Professor John Trimble (author of Writing with Style: Conversations on the Art of Writing) and his telling me about the perspective of John Vlissides (co-author of the GoF book Design Patterns: Elements of Reusable Object-Oriented Software) of the same as well as the author of Pattern Hatching, (4) Other stuff?.

  2. Your website is terribly informative and your articles are wonderful. Visit:ビッグデータ γ‚»γƒŸγƒŠγƒΌ

    1. - Thank you, Aeldra, for making the time to read my essay, and for sharing your kind thoughts.
      - Please know that encouraging comments such as yours make my day, every day :)
      - Sure thing, I'll check out the datamix link you shared...

  3. - I'm simply overwhelmed  (in a very good way) by the encouraging and warm messages of appreciation that I've received (here, and also personally, elsewhere than via the comments available in these blog posts) in response to this essay!
    - Thank you all so much :)
    - Here I will share only one such message; the sender will remain anonymous as I wish to totally respect their anonymity. This particular message went like so:

    "Akram - Very deep. I enjoyed the premises. Especially beautiful things endure and not out of negativity. I especially like the notion of code in the English prose and the Lords Cricket ground was poignant."

  4. Dear Akram, I am entranced by the spirituality you have injected into your writing - its going to take me a few readings to absorb all the nuances!

  5. - Thank you very much, Saqib, for those effusively keen words of perception and appreciation. As I continue to get kind messages from readers like you, I'm filled with gratitude.

    - And here I can't help but think to an observation by Pablo Picasso when, as he memorably put it: The purpose of art is washing the dust of daily life off our souls.

    - I say so because the charter, if you will, of my blog is to share Essays at the intersection of culture, software, technology, and science. Again, thank you.

  6. From sparkly em-dashes to Frank Lloyd Wright's masterpiece Fallingwater--I was challenged and intrigued and educated throughout. Thank you for pulling together so many sources to back up your insights. The English teacher part of me wants to weep with joy while the Business Systems Analyst side of me wonders, "Where in the world did he get the time, energy, and brain power to construct such an essay?"

    1. - I'm immensely grateful, Beverly, for your thoughtfully elegant comment. That you took the time to read the essay multiple times—to unpack the ideas that I had carefully stowed away in it—is tremendously encouraging and heartening.
      - So I get to wear many hats when going about writing up essays such as this one: (1) the hat of a computer scientist (carving, reassembling, and presenting ideas to get them across in a coherent way), (2) the hat of a writer (taking utmost care to serve my readers, instead of succumbing to the all-too-easy escape hatch of seeking to impress the reader, because I value your all's time immeasurably to even contemplate doing otherwise), and (3) the hat of an artist (weaving together strands of ideas and themes, sometimes tangentially-related though they might seemingly appear, into the faithful whole of a unified tapestry).
      - To briefly add to that, I'll slip this in, edgewise: I often remind myself of George Bernard Shaw's delightfully memorable words—harbingers of eminently sound advice—that
      In literature, the ambition of the novice is to acquire the literary language; the struggle of the adept is to get rid of it.
      - And to your other kind point, where you wonder quizzically—all the while graciously sounding polite notes of civilized diffidence—as to "Where in the world did he get the time, energy, and brain power to construct such an essay?"... Please allow me to say only this much, and parenthetically at that; I won't elaborate further, leaving you and other readers to draw your own conclusions. So one of my programming heroes is Guy Steele, the lead author of the Java Language Specification. Steele noted in the Acknowledgments section of his tour de force on programming, entitled Common Lisp: The Language, 2nd Edition how
      Most of the writing of this book took place between 10 P.M. and 3 A.M.
      Okay, so that precise window of time wouldn't work for me; I would need to slide it forward—fabulous sliding windows anyone?—so as to have the window start an hour or two past Steele's shutdown time. Enough said :)

    2. - Adding some afterthoughts...
      - I have to confess that pursuits other than crafting these essays often clamor for my attention and energy; often enough that I'm admittedly left with the sinking feeling that any given essay could have used more polish. Whenever possible, I try to emulate at least the spirit of the brilliant Renaissance artist Michelangelo who, when he was asked about the difficulties that he surely must have encountered in sculpting his masterpiece David, replied with an unassuming and comical description of his creative process:

      It is easy. You just chip away the stone that doesn't look like David.
      So there :)

      - There have been occasions when I've had the luxury of lavishing care on my essays—which I write of course for readers like you—to the extent that I felt a given essay warranted; but those occasions are not as plentiful as I would wish for them to be; yes, the clamor of reality intrudes jarringly often...
      - Then again, I remain (as a computer scientist/writer/artist), ever mindful of the message contained in a startling phrase—at least that's how the phrase grabbed me on my first encounter with it—that "Real Artists Ship": Seth Godin's bestseller entitled Linchpin: Are You Indispensable? (p.101). Godin goes on to remind us that

      Artists don't think outside the box, because outside the box there's a vacuum... Artists think along the edges of the box, because that's where things get done.

      And if my reader feel compelled to discover more on this very theme, I recommend that you flip forward just another page, to Linchpin: Are You Indispensable? (p.103) for a delicious serving of What It Means to Ship, in an eponymous section.
      - Finally, I wish to acknowledge your marvelous use of the construction metaphor; that is precisely what I was alluding to when I mentioned at the outset (of this reply) in connection with unpacking the ideas that I had stashed away (in this essay). That you have deconstructed par excellence what I had submitted in this essay—as you noted when remarking about my pulling together a bunch of sources to back up the insights—is writ large in your reply. So I thank you again.
      - Ah, as to Frank Lloyd Wright's masterpiece Fallingwater, which adorns this essay... Would anyone be surprised that I had contemplated, if ever so briefly during middle school, the prospects of becoming an architect? I guess there's always software architecture lol.
      - LOL, those sparkly em-dashes, eh? Truth be told, I've found my selfsame elixir in them, yes I have ;)

  7. Very interesting comparison. Great quotes :)

    1. - Thank you, Ayesha, for making the time to read the essay, plus sharing your thoughts via the comment! I'm happy that your interest was engaged and retained by the theme of exploring the (synthesizing) juxtaposition—or comparison as you aptly put it—in a meandering style, of course; once again, alert readers will note the undercurrents of the eponymous charter of Programming Digressions (aka writings that lie at the intersection of culture, software, technology, and science) permeating this and other essays.

      - As for the quotes I select in adorning my essays, every quote—yes, every single quote—undergoes a battery of challenges:
      [1] Does the quote have a good chance of adding to the reader's enjoyment in a relevant way, without being cute?
      [2] Will the quote help with the flow of narrative?
      [3] Can the reader possibly be confused by a potentially dense or ambiguous quote?
      [4] Is the quote amplifying the message I'm trying to get across?
      [5] Will the reader hear a strongly conversational voice, or is the quote making my narrative sound like a book?
      - To the extent that I succeed—or fail—at making my (essay) drafts run the gauntlet of the challenges above, I will have succeeded—or failed—at serving you, my readers.

      - I'll add in passing that two essays in particular come to mind where I reckon I had something of a swimmingly good run at enlisting the aid of quotes in making the narrative flow a tad smoother, perhaps:
      [a] This essay was a thematic analysis—actually, part synthesis as well—of blending two seemingly unrelated streams of languages (the natural/spoken kind, and the computer/programmatic kind, though the latter should not necessarily be viewed as unnatural, lol).
      [b] And this one was an (in-depth) exploration of the finest resource for navigating the Clojure programming landscape.

  8. I grew up in the hills of Western Pennsylvania, but oddly, I never visited Fallingwater until many years later, after I had already moved to Texas and, one summer, decided to revisit the land that I had walked as a boy.

    Fallingwater cannot be understood by looking at pictures, it has to be experienced. I know that now, it is perhaps the most important lesson I learned from my visit. That some things cannot be explained by words or pictures. You must dwell for a time within the walls, walk down the passageways, peer across landscapes, discuss the origins and history. A picture is worth a thousand words, we say, but to actually exist within a great architecture is to let the soul of the place seep into your bones.

    A house is a house is a house. They all have walls, and a roof, and windows and floors. But they are not the same. Some houses are just there to cram people in, to keep out the rain, to hold the detritius of our lives.

    But some houses have a view. And we will value more such a house, and pay more for such a house, without understanding why. Covering your walls with montages of Greece will not replace the experience of waking up in the morning, going to your window, and looking out over the cerulean Mediterranean.

    Fallingwater matters not just because it is a novel, interesting house by a famous architect. It is a point of integration, between the living space of humans and that of the wilderness, that is thoughtful and respectful. And even more, it represents a point IN TIME that we know will not likely return. You can't visit it without both: entering a sacred space; and stepping back in time.

    Build things with care.

    1. - Thank you, Gregory, for sharing those marvelously eloquent observations. As the author of this blog, I'll try to do some justice in responding; there's a lot that you've packed in articulating the crucial vitality of, as you nicely put it, "build[ing] things with care".

      - As a software craftsman, your advice—and I'm constantly learning from my readers—by way of that delightfully evocative phrase ("Build things with care"), and toward which you were building up your detailed comment, is one that'll remain with me for a long time, so thank you!

      - I have, as you may well have guessed, way more than a passing interest in the field of architecture: My essays, as you may well have discovered by now, are replete with references to architecture—both the software and the bricks-and-mortar kind :)

      - The picture you've painted with your words in how "Fallingwater cannot be understood by looking at pictures, it has to be experienced" is remarkable. I'll be revisiting your detailed comment many times over to savor the evocative theme—of the timeless way of building—which you've managed to pack in your comment.

      - Yes, I, too, find myself resonating with how your point regarding Fallingwater that, "You can't visit it without both: entering a sacred space; and stepping back in time". Clearly, I need to visit Fallingwater in person :)

      - Thank you, Gregory. And yes, I'll do my best in remaining mindful of build[ing] things with care!