Essays at the intersection of culture, software, technology, and engineering

Lit Gets Tech Makeover

Life imitates Art far more than Art imitates Life.~ Oscar Wilde (in The Decay of Lying)

Good mathematicians see analogies between theorems and theories; the very best ones see analogies between analogies.~ Stefan Banach (Math whiz)

Introduction

Given the sensational nature of the material you’re about to lay your eyes on—just check the vibrant web of activity taking place in the one picture above alone, with artful lambdas recursing into fully functional objects and lively creatures burrowing into art—I say that a few words are in order to calm down your tingling nerves, lest we start right off the bat with jangled nerves:

This material, having been unanimously heralded by numerous learned societies for its unique contribution to pushing the horizons of human knowledge, is being simultaneously nominated for (1) the Fields Medal, and (2) the Nobel Memorial Prize for Literature.

Like, what’s up with that? Here’s what: Yo, in all seriousness, this work is being nominated—and self-nominated at that, in case you haven’t yet heard about self-signed security certificates—to potentially garner the Fields Medal (for the high quality of this work’s mind-bending explorations that have given a new lease on life to the Banach quote above (“Good mathematicians see analogies between theorems and theories; the very best ones see analogies between analogies.”)

As for the Nobel Memorial Prize for Literature—Akram, Akram, Akram, you’re pushing it, dude—it’s just that I have been told on good authority that one should always write as if going for the Pulitzer. So that’s that.

Darn, don’t tell me it’s too late to nominate this sensational work for the Pulitzer Prize as well? (Oh, and then there’s the Turing Award!)

At any rate, I urge you to take a few deep breaths and ingest only in small pieces everything that follows, lest you get the bends.

Okay, what with that Good Housekeeping-approved list of to-do’s out of the way, let’s check how it came to be that literature—of all the things under the sun—got itself an extreme tech makeover when we were not looking…

A Sign Of Things To Come…

“Human design” is impossible, Hayek says, because the relevant information flows are “beyond the span of the control of any one mind.” The market dynamic makes it possible for people to operate in ignorance without “anyone having to tell them what to do.

~ Shoshana Zuboff (in The Age of Surveillance Capitalism: The Fight for a Human Future at the New Frontier of Power — published by PublicAffairs)

Before you impugn my motives—and so much for putting faith in “human design,” if we are to take a page from the fantastic book I briefly quote above and of which I’ve skimmed numerous swathes only thus far—can I appeal to your tender heart so it’ll yield and allow me to offer a few words in defense?

I know, I know: A few of you are already muttering under your breath, “Man, should we (or shouldn’t we!) give Akram what he’s is asking for, knowing full well his fondness for digressing?”

Heh, heh, hey… Looks like my reputation precedes me everywhere I go nowadays. But seriously, this is how it happened. Yes, this really is how literature got itself an extreme tech makeover to became an overnight sensation.

Woot. Nothing Less Than Guaranteed Delivery

Art is the imposing of a pattern on experience, and our aesthetic enjoyment is recognition of the pattern.

~ Alfred North Whitehead

Check the penetratingly fierce gaze of the spotted owl above (Yep, all owls gaze fiercely when they’re not sleeping, which is pretty much all the time.) Anyhow, if you remember those letter-bearing owls from Harry Potter movies—the feathered legions enlisted by the Owl Postal Service who kept delivering their missives with unerring accuracy, reliability, and with nary a smidgen of eventual consistency—you got it! What they had going on was nothing more (or less) than Guaranteed Delivery.

But of course. Yep, that’s how literature—hey, if you’re going to pooh pooh the fine literary work of JK Rowling as lowbrow, you might as well stop right here!—started getting infused with a new lease on life, morphing into technological vistas in a singularity-inspired moment (though some insist that the Singularity has to wait till the year 2045. Darn.) And yes, that’s how (in equal doses) technology vistas began spilling over into literary pastures.

Oh my! (Didn’t I tell you to take in everything that follows only in itty bitty, digestible pieces? Anyone around here got Maalox? Like, lots of it!)

It’s Linked Lists All The Way Down

The web, then, or the pattern; a web at once sensuous and logical, an elegant and pregnant texture: that is style, that is the foundation of the art of literature.

~ Robert Louis Stevenson

Hey now, for a bit more on what we’re getting ourselves into—by way of a handful more of cameos like this one—and as a sign of things to come right here in this sensational work, scroll up (just a bit) and see if you can spot the magnificent giraffe trying to hungrily burrow its face into the juicy underside of the leafy heavens towering above it…

All The World’s But A Stage

Nature is wont to hide herself.~ Heraclitus (in On the Universe)

Nah, the honest-to-goodness Façade design patterns is definitely not for hiding your spaghetti code; mine neither (I remain unabashedly inspired by the personal example of the late John Vlissides—the “V” in GHJV, the initials of the GoF—in that if we occasionally can’t laugh at our own selves, then something pretty basic is wrong.)

Okay, so the Facade is really good when you find yourself in a pinch—should you wish to simplify access to functionality in complex or poorly designed subsystems. (Goodness, I love the design of that crimson facade above, hiding behind its elegance all the lachrymose grunginess of those behemoth, steel-girded skyscrapers.)

Cozying Up To The Progenitor

Once upon a time…

~ Traditional opening to a story

Ah yes, any time you wish to (and you should!) cozy up to the genesis of the patterns movement—which has done for the software landscape what the architect Christopher Alexander did for the brick and mortar landscape—and you wish to look the part of the self-respecting tech type, you simply have to have a copy of the Gang of Four book lying around your workplace. Think instant gravitas. Think pronto credibility 😉

Ahoy! Our Ship’s About To Set Sail…

Ahoy! All aboard. So please don’t you be left behind. Like, I’m not going to come back and console your poor, moping self, if you do get left behind, you know.

To run over better waters the little vessel of my genius now hoists her sails, as she leaves behind her a sea so cruel.~ Dante Alighieri (in The Divine Comedy)

Hey, what’s up with the sweet picture—laden with symbolism out the wazoo—coming right up? Whoah, that sure smells like mouth-watering baklava!

Pattern Languages Redux

Yeah, now we dive into the essay proper—having dispensed with all the improper stuff I guess—and which, in turn, makes this is the perfect time to get ourselves oriented. Here’s the deal: Everything that follows is cast in the shape of a Pattern Language. “What’s up with that?“, you may be asking yourself 😉

The speech of man is like embroidered tapestries, since like them this too has to be extended in order to display its patterns, but when it is rolled up it conceals and distorts them.~ Themistocles (An ancient dude)

Yo, embroidered tapestries and such, eh? Does this blogger, like, speak in parables or something?

While you’re figuring that one out, let me tell you how this (patterns thing, you know) came to be. So the (predominantly software-oriented) patterns community was inspired into creation by the slick work of the UC Berkeley architect—as in a bricks and mortar architect, not the bits and bytes type—Christopher Alexander, and the ideas of a Pattern Language have achieved near-universality, becoming quite the movement.

And I’m going to lean on that movement by creating a Pattern Language of my own, which is made of these exquisitely arranged elements:

Pic: A thematic picture illustrating the central idea

Intro: Exactly that, an… Intro 😉

FavEnterprise Integration Pattern

FavDistributed Computing Wisdom

FavGang of Four (aka GoF) Design Pattern

FavAlgorithm & Data Structure

Consequences

FavWebsite

Also Related (But Little-Known)

And as if that weren’t enough, we have a full, complimentary cast of characters—a veritable Who’s Who from the glorious history of fine literature—who will serve as the target for each one of the lovely themes above.

With a drumroll, and not a little fanfare either, please welcome our cast:

Shakespeare

JK Rowling

Sherlock Holmes

Henry David Thoreau

Charles Dickens

The Brothers Grimm

Didn’t I tell you that we got a Who’s Who at hand? Oh yes, in a twist of sorts—and I know full well, you sharp readers out there whose mischievous eyes are lighting up this instant—what we’ve really going on here is a remarkable illustrated of the Inversion of Control (anyone remember the Dependency Injection pattern and stuff like that?)

So, instead of divvying out the various patterns, etc.—Enterprise Integration Patterns, GoF Design Patterns, Algorithms & Data Structures, Distributed Computing Wisdom, etc.—according to the tastes (and needs!) of the illustrious writers above, we are going to turn the tables and make the writers go (so to say) to those patterns instead, thereby injecting literature into technology. Now how about that!

See the stone set in your eyesSee the thorn twist in your sideI wait for you~ U2 (lyrics from With Or Without You)

Ready, Player One? (I’ve been waiting for you, with or without you…) Okay, good, glad you’re back; we’re ready now.

Yep, what we do next—right after an ever-so-brief—intro to our motley crew of characters is that we’re going to divulge, for the first time ever in recorded history, what their favorite software design patterns (and stuff like that) are (or at least would’ve been, were most of them no longer dead.)

The Cast: A Who’s Who

I believe a leaf of grass is no less than the journey-work of the stars. ~ Walt Whitman

Without further ado, here’s the scoop on the stars of our dazzling cast:

Shakespeare: The Bard. Does he need an introduction? Words never had it so good, I’m telling you (Take it from your blogger, who turns green with envy each time he cracks open his copy of The Complete Works of William Shakespeare and starts thumbing through its pages.)

JK Rowling: If anyone has minted a billion dollars on the back of a series of books—the Harry Potter series, plus the movies made out of them—it’s her. Fun trivia: Rowling has made Edinburgh her adopted home.

Sherlock Holmes: Okay, so I made this one up. It is Sir Arthur Conan Doyle who created the character (of Sherlock Holmes), the fav sleuth of generations of readers, loved (in a platonic way, of course) the world over.

Henry David Thoreau: If you thought Walden Pond on reading that name, you got it! Yep, the time he spent in Walden Woods became a model of deliberate and ethical living for those who chose to follow in his footsteps.

The Brothers Grimm: If you ever wanted to thank someone for saving the fairy tales from becoming extinct, it’s them. Here are the grim facts, er, the Grimm facts, I meant to say.

Yep, that’s them. That’s our starring cast. (I’ve been begged and cajoled out of sharing a dissertation on the symbolism of the spray cans in the picture above insofar as our beloved, literary titans are concerned… Okay, I wanted to digress. But didn’t. Just so you know.)

Fav Enterprise Integration Pattern

Intro

Well, if your Spiderman senses (aka “spidey” senses) were tingling as if there was no tomorrow as soon as you spotted that dry-eyes relief bottle above (the one that’s precariously perched atop my copy of the veritable fount of industry wisdom that we know and love as Enterprise Integration Patterns), it’s actually dry eyes that we get—not the blue eyes that Elton John rapturously is singing about—when we do a thing like immersing ourselves in the arid wild, wild west (and roller-coaster!) world of enterprise integration.

Your mood is like a circus wheel,You’re changing all the time,~ Fleetwood Mac (lyrics from Over My Head)

Oh yeah, enterprise integration is nothing less than a circus wheel.

Okay now, take a deep breath; it’s all serious business from here on. (Yeah right, Akram, like we trust you when you say a thing like that!) Darn.

(Incidentally, since we were chatting about your eyes—either blue or dry, possibly both—you wish to look up an extraordinary novel named The Bluest Eye by the author Toni Morrison, the acclaimed African American novelist, Pulitzer, and Nobel Prize winner. But I digress.)

Shakespeare

The Bard sure could have saved himself (and his audiences) from a whole lot of grief when writing his plays—the tragedies, the histories, and especially the comedies—if only he had made more use of the nifty Correlation ID. I’m telling you: Considering the vast numbers of characters teeming in his plays, what not with mistaken identities at the drop of a hat, people getting confused left and right, and all kinds of weird happenstances feverishly playing themselves out, the Bard could simply have leaned on traceability to bring sanity to his sprawling stories. Yep, just slap a Correlation ID on every character so we know where anyone’s at any given time. End of confusion—a whole lot of confusion, mixups, and endless series of complications.

JK Rowling

The author of the Harry Potter series definitely put a lot of faith in Guaranteed Delivery, judging from the meandering stories which have graced those series of books—in full disclosure, I have not cracked open a single book in the series, instead choosing to satisfy myself with watching the movies (Hey, that’s plenty good, I’m telling you.) Okay, putting aside minor details (such as the messaging system making use of a built-in data store to persist messages), the main thing here is that we sure got all those letters delivered. Like, on time. And that’s guaranteed delivery for you. Western Union, eat your heart out.

Sherlock Holmes

Oh yeah, it’s Pipes and Filters; what else could it possibly be? All day long, too. Our sleuth sure knew his pipes from his filters. And he should have; Mr. Holmes could be found in their company when he was not hunting down the bad guys. So forget about the need to transform a stream of (possibly) duplicated, encrypted messages containing extra authentication data into a stream of unique, simple plain-text order messages without the extraneous data fields. Let’s all go back to the basics; let’s take a page out of the famous detective’s notebook, shall we? (Severe Warning: On the authority of the Surgeon General of the United States—further substantiated and reaffirmed by my eminently knowledgeable hairdresser—tobacco is extremely injurious your health. Repeat after me, “Doing tobacco is a really, really dumb thing!”)

Henry David Thoreau

Oh my, Mr Thoreau sure didn’t want to have much with incoming communications (or outgoing, for that matter!) Like, this reclusive author went to live a secluded life on the shores on Walden Pond, vehemently desiring to—let’s all say this together now!—”Simplify, simplify, simplify” his life. Yep, the Dead Letter Channel was his cup of tea, of which he sipped many a cup while watching Netflix on the shores of Walden Pond (Concord, Massachusetts.) The deal here of course is this: Whatever machine a message dies on, it can be moved from one local queue to another without any networking uncertainties. But hey, Thoreau did not so much as entertain a single message, let alone messages! You see, he was really into keeping up on the latest episode of Game of Thrones (Yes, and for that he needed monastic concentration, much like renowned computer scientist David Knuth, who once memorably noted that, “Email is a wonderful thing for people whose role in life is to be on top of things. But not for me; my role is to be on the bottom of things. What I do takes long hours of studying and uninterruptible concentration.” (Now how about that?)

Charles Dickens

Want to take a guess? If you said Process Manager, you got it! For crying out loud, if ever there were meandering storylines that somehow had to be routed through a dynamic series of processing steps, they can all be found in the novels that Dickens wrote. I mean, just take the example of the hapless boy Pip who (in the novel Great Expectations) runs into an escaped prison convict in a setting no less desolate than a deserted cemetery, story just sprawls and sprawls, with no end in sight. If only Dickens had taken the advice of his therapist—as well as yours truly—and made profuse use of the Process Manager pattern, we all would have ended up with much simpler stories. But he listened to neither his therapist nor me. And the rest is history. Darn.

The Brothers Grimm

Not many people seem to have heard of the Wire Tap, which is a pity (And no, we’re not talking about Spinal Tap!) Those brothers, the twosome, sure knew you how to tap into the psyche of society, wrench outs its innards, and distill their gory essence into (the seeming innocence of) fairy tales. Oh my! But somehow they pulled it off. Ah yes, so now we can blithely insert a generic Wire Tap into any channel without any danger of modifying the primary channel behavior (Remember, this improves reuse and reduces the risk of instrumenting an existing solution.) But the Brothers Karamazov, er, the Brothers Grimm, I surely meant, didn’t care one bit about inadvertently modifying the primary channel behavior. Oh no sir, they didn’t give a hoot. I wonder how things might have turned out if they did… I wonder if they had read—and tapped into the wisdom of—the tour de force that is The Age of Surveillance Capitalism: The Fight for a Human Future at the New Frontier of Power by Shoshana Zuboff (published by PublicAffairs). But I digress.

Fav Distributed Computing Wisdom

Intro

Now this is the realm which reeks of the wisdom of, other things, Microservices, Service Oriented Architecture, the RESTful style in particular, and Domain-Driven Design. This is not for the faint of heart.

Puritanism: The haunting fear that someone, somewhere, may be happy.~ H. L. Mencken

But our lion-hearted literary titans were fearless, which is actually a darn good thing; otherwise, who would have fulfilled the singularly symbolism-laden dreams of the masses—all uninterpreted until that smart cookie Sigmund Freud appeared on the scene—that yearned to breathe free? But fear not, and let’s check what the fav of each one of our literary tycoons.

Shakespeare

If the Bard ever had one fav, it was surely this. In two words: Event Sourcing. Is that sweet and simple or what? The Bard, shrewd businessman that he (secretly) was, knew full well remaining competitive was crucial to his survival. It’s really simple: Given the Byzantine plots of his dramas and plays, the Bard understood—grokked, really, though he would of course never confess to using a work like that even as he blithely continued to grep and pilfer from the work of other dramatists like there was no tomorrow—and at a visceral level, too, that his literary enterprise depended on deeply understanding many aspects of the data at his disposal, including detailed behavior of his customers. Well, here’s the deal: Using event sourcing, he set about determining what the state of the system looked like at any given point in time and how it reached any of those states. For many domains, this is a game-changing capability. There you go. The rest is history. And yes, all the world’s but a stage. Darn. Words never had it so good as when William Shakespeare was around!

JK Rowling

The author of the Harry Potter series sure put a lot of faith in Eventual Consistency, judging from the meandering stories which have graced her contributions to literature! I mean, having talked with some who have read her books—I’ve already fessed up in full candor that I have only watched the movies—it seems like the twists and turns of the stories are snake-bitten, about to implode at any moment. But heh, they all come together in the end, don’t they? (Hint: Yes. Otherwise, her bank balance and mine would turn out a wash.) Wow. Amazing how things turn out. The Black Swan.

Sherlock Holmes

I’m telling you, our stalwart sleuth was smitten by CQRS (Command Query Responsibility Segregation) the moment he set his eyes on it. Yes, love at first sight. If that surprises you in the least, consider this: Considering the amount of information flowing through his cranium, Mr. Holmes had better had his read and write models optimized. You see, not only was he a voracious reader, he was also known to furiously scribble away in his notebooks (that is, when he was occupied by Pipes and Filters.) Darn, he penned a plethora of monographs. Hence, his love of all things CQRS.

Henry David Thoreau

A Value Object, or two, or three, or… Oh yes, very much in the spirit of brilliant dramatist and playwright Oscar Wilde—who once memorably noted that “A cynic is a person who knows the price of everything but the value of nothing“—our pal Thoreau was all about stripping away the trifling baubles in life that distract us away from the essence of how one’s life should really be lived. As an aside—in case you noticed yet another hyperlink above to the profound thinker that is Martin Fowler—one of my programmer friends back in Minnesota used to unrepentantly call him Martin Flowers (That was awesome! But hey, a rose by any other name would smell just as sweet.)

Charles Dickens

Want to take a guess? If you said “Saga“, you got it! For crying out loud, and while sagas may not be as popular today as they were in yesteryear, they sure can come in handy at times. If ever you’ve found yourself grappling with the need to achieve local transactional goodness when a microservice needs to perform multiple activities as an atomic operation, then you want to look anew at your design problem through the lens of sagas. Got it? Cool. And Dickens had a good thing going with sagas since his monumentally sprawling novels unfolded )at the warp speed of crab-grass growth rates) over—not dozens—hundreds of pages. Hence, sagas.

The Brothers Grimm

Given the tremendous sprawl that was their fairy tales, the bros definitely needed a reliable mechanism to prevent the leakage of abstractions (which is, incidentally, yet another lovely idea brought to us programmers from the fertile land of Lisp). Yep, they sure could have used a strategy to keep their plots from morphing into one another through slippage—I mean, do you really want poor Cinderella to be devoured by the big bad wolf and stuff like that? And that’s when the bros luckily across the notion of normalization. Woohoo, love at first sight! Now they knew how to structure their fabulous fairy tales in such a way that there was no redundancy or duplication. In a normalized compendium of tales, when some portion of data changes, you only need to change it in one place, not many copies in many different places. Yep, from then on, it was normalization (in all the lovely and varied normal forms) all the way. Oh, as a caveat, let’s just say that they lucked out with not having to deal with the crucial distinction between Many-to-One and Many-to-Many relationships. But I digress.

Fav Gang of Four (aka GoF) Design Pattern

Intro

Yeah, the boy can playDedication, devotionTurning all the night time into the day~ Dire Straits (lyrics from Walk of Life)

Oops… Slight mixup there, I’ll fess up, by yours truly. And yes—as always—right you are (Can the Reader—or Customer, for that matter—ever be wrong? Repeat after me, “Never!” See, I even spelled both words with a gold-plated, uppercase letter to underscore that very importance. I had a picture of the Gang of Four lying around here, but somehow things got swapped. Anyhow, let’s dive right into it and find out which GoF pattern our literary luminaries were respectively enamored of, shall we?

Shakespeare

Ah yes, Strategy sure fit the bill nicely for the Bard. It went like this: The Bard went hunting—his heart weighed down by the Quixotic quest for bringing manageability to the proliferating plots of his plays and dramas—and struck gold immediately on walking into his neighborhood Barnes & Noble (brick-and-mortar) bookstore. You see, no sooner had he crossed the threshold of the bookstore than he stumbled over a copy of the GoF book that a careless patron had left on the floor. And guess what? Intrigued by Escher monolith on the cover, the Bard cracked open the book to the page which had the introduction to the Strategy pattern. Wow! Need I say more? Cuz’ I fear the slings and arrows of derision singling me out for digressing… Sigh, the life of a writer sure ain’t easy. But yes, the Bard was smelling like the roses once he cozied up to this behavioral software design pattern that’s all about enabling selecting an algorithm—read character, or possibly even plot—at runtime (read showtime, at the Globe, where else?) Instead of implementing a single algorithm directly, code receives run-time instructions as to which in a family of algorithms to use. Life was good (for the Bard). And words never had it so good, I’m telling you.

JK Rowling

With the furious rate at which magic spells were being cast by Rowling’s characters, it was merely a matter of time before they invoked the Prototype design pattern. I’m going to leave the details of your imagination. (Hey, I can’t spell—pun was not intended—everything out, for crying out loud.) But suffice it to say that Harry Potter and the crew liked the Prototype design pattern so much. Ah yes, it was off to the races with Wingardium Leviosa and stuff like that. It was… Riddikulus!

Sherlock Holmes

Sheesh, did he really? I mean, did our beloved detective actually know all those languages? Wow! He surely must have made liberal use of the Interpreter design pattern, amirite? How else? The way our sleuth on the ground was able to define ways for controlling communication between classes and entities, the way he defined the grammar for instructions that form part of a language or notation, whilst allowing the grammar to be easily extended… Fess up now, Mr. Holmes, you had the Interpreter up your sleeves all the time, didn’t you?

Henry David Thoreau

The sage of Walden Pond was wont to say these these three words (actually just the one measly word, repeated thrice) to anyone who would listen to him in the woods of Concord, Massachusetts—that was mostly the birds, the bees, and the hapless deer or two—and his message was, “Simplify, simplify, simplify!” (Read that as Facade, Facade, Facade). So what’s up with that? Here’s what. The facade pattern is a design pattern that is used to simplify access to functionality in complex or poorly designed subsystems. The facade class provides a simple, single-class interface that hides the implementation details of the underlying code. “Oh no,” said the sage, “We ain’t gonna have nothing to do with that sort of thing. Uh uh, no Sir, and no Madame“. We want pristine simplicity. And he sure got it, thoroughly, too, did Mr. Thoreau (And no, not Thurow, since we’re not talking about our pal at MIT, the late Lester Thurow.)

Charles Dickens

The Abstract Factory for sure must have been Dickens’ cup of tea, amirite? I mean, the rate at which he was spawning characters to populate his novels, he simply couldn’t have escaped leaning on the Abstract Factory pattern. Given that this is the one-and-only fabulous creational pattern that is used to control class instantiation, it fit the bill for our dickens of a writer whereby he was able to provide a client with a set of related or dependent objects. You see, the family of objects—and it was one, monumentally large, disparate family—created by the factory is determined at run-time according to the selection of concrete factory class. Yes, life was good (for Dickens, at least). Us poor souls, however, had to plow through the mountains of pages that made up his novels (Shh… Were it not for those trusty Cliffs Notes, most of America, myself included, would have flunked out of our English Literature classes in college. You can keep a secret, right, can’t you now, dear and patently pretty Reader?)

The Brothers Grimm

And if you thought that life was going to be brutish and short (for us college students, back in the day) without those life-saving Cliffs Notes, I have another thought coming for you: How would our bros have tamed the complexity of their fairy tales without the trusty Template Method? Given all the problems they were having with plumbing in their stories—remember how we talked about wrestling into submission those persnickety leaky abstractions a few minutes ago?—the bros did well to reach out for this design pattern which is all about allowing a group of interchangeable, similarly structured, multi-step algorithms (read, fairy tales) to be defined. Each algorithm follows the same series of actions but provides a different implementation of the steps. Yep, no need to call Roto-Rooter. Yay!

Fav Algorithm & Data Structure

Intro

Well, what can I say? Modesty forbids. I can, though, point you in the direction of some stuff I wrote up many moons ago on a subject that remains dear to my heart—the design and implementation of computer algorithms and data structures—and which I trust will suffice as an introduction of sorts (Nah, not of sorting. For that, please consult the canonical works.) So how about you check out this and this, too? Cool?

Space has always been the spiritual dimension of architecture. It is not the physical statement of the structure so much as what it contains that moves us. ~ Arthur Erickson

With that, let’s check out what our literary aficionados called their own when it came to algorithms and data structures. Read on.

Shakespeare

Oh yes, Graphs (and in particular the Depth-First Search algorithm) did it for the Bard. And it had better. I mean, how else could he not have made Hamlet (that poor, moping Prince of Denmark) say something as profound as “To be, or not to be, that is the question: Whether ’tis nobler in the mind to suffer; The slings and arrows of outrageous fortune, Or to take arms against a sea of troubles; And by opposing end them.”) Darn, what a line! It’s like, the Bard sure was wont to dive into the deep end of the pool straight away, then work his way laterally. Oh no, Shakespeare wasn’t one to beat about the bush!

JK Rowling

Recursion. All the way. And back again, too. All over again, I’m telling you. Backwards, and forward, too. And if your head isn’t already hurting—I’m reaching for some Advil even as I jot this stuff down—please take comfort in knowing that the creator of the Harry Potter series meant well. She really did. With a little bit of handwaving, I say that we leave this one, too, to your imagination (Hint: Think of the Byzantine plots, the twists and turns, time-traveling and other fancy stuff…)

Sherlock Holmes

“Gimme some honest-to-goodness Regular Expressions“, so said our sleuth. And many a time, too! It was, like, the rate at which Mr. Holmes had to parse the never-ending stream of data coming his way into something coherent—without so much as a distributed commit log to lean on—the slick sleuth went all out for Regular Expressions. Oh yes he did. That why they say that necessity is the mother of invention. Anyhow, having done so, life became easy, at least easier; Holmes still had to deal with the aftermath of having dug himself deeper and deeper into complex grammars in connection with his fondness for making use of the Interpreter.

Henry David Thoreau

If you said that the Sage of Concord had a thing for the Bubble Sort algorithm—as well as for the novel Of Human Bondage by Somerset Maugham—you got it right. You see, Thoreau was all about simplifying things, even if it meant resorting to brute force (My professor of computation strategies, back in college, many years ago, would have called this sort of thing BFAI: Brute Force And Ignorance. But I digress. Yo, aren’t digressions fun?) It’s been reported that Google CEO Eric Schmidt once facetiously asked Obama, “What is the most efficient way to sort a million 32-bit integers?” Obama answered “Well, I think the bubble sort would be the wrong way to go.” So why don’t we have those two eminently fine Americans—Thoreau and Obama—have a chit-chat with each other on the Bubble Sort and other weighty topics? Meanwhile, I’m out of here. Oh wait, there’s more?

Charles Dickens

Diametrically opposed to Shakespeare’s choice—which as we learned a few minutes ago was the Depth-First Search algorithm—Dickens had a thing for Graphs (for the Breadth-First Search algorithm, specifically). You see, unlike the Bard, who immediately had his characters dive into the deep end of the pool, saying profound stuff like “To be, or not to be, that is the question: Whether ’tis nobler in the mind to suffer…”), Dickens took it slow. Real slow. I mean, he took his long sweet time, for crying out loud. Take, for example, how his meandering storylines that somehow had to be routed through a dynamic series of processing steps: Just think to how the hapless boy Pip who (in the novel Great Expectations) runs into an escaped prison convict in a setting no less desolate than a deserted cemetery, story just sprawls and sprawls, with no end in sight. Hence, it had to be the Breadth-First Search algorithm to the rescue, to help us find our way through the (seemingly) non-terminating graphs (definitely most-densely connected, with plenty of cycles in there!) which knew no end, amirite? Gotta love those algorithms.

The Brothers Grimm

I’m telling you, it was Linked ListsandPointers (all the way down!) There’s no other way Hansel and Gretel could have escaped the wicked witch without the notion of pointers (physical breadcrumbs) traverse length list informing their (escape, what else?) strategy, every step of the way. Like, their lives depended on a faithful adherence to what have since then been enshrined as one of the core tenets of computer science. Speaking of breadcrumbs, they, of course, are a secondary navigation format that reveals the user’s location in a website. I knew somebody was going to spring that factoid on me, soul I’m doing a preemptive strike, so to say, before you can foist such stuff, hah.

Consequences

Intro

Oooh, so what’s gonna happen? Well yes, Consequences are just that, the repercussions, the aftermath, and fallouts. A bit more formally, they refer to a description of the results, side effects, and trade-offs caused by using a given design pattern, of which we’ve seen plenty already, right? (What’s that you say, you want to see even more?!)

Nothing is worth doing unless the consequences may be serious.~ George Bernard Shaw

Hold on. First, let’s see what happens when stable of authors apply their favorite design patterns (and stuff like that) to their respective works…

Shakespeare

The Bard’s comedy named A Comedy of Errors is reduced to a mere three pages—take that, Cliffs Notes!—through a simple application of those nifty Correlation IDs. No more confusion. Life is traceable once again; life is simple, and good. We like it that way, yay! The only drawback I can think of is that we might lose a popular idiom of the English lexicon; in the centuries following its premiere, the title of that play (A Comedy of Errors) has entered the popular lexicon as an idiom for “an event or series of events made ridiculous by the number of errors that were made throughout.” But hey, we can live with that and gotta hand it to those nifty Correlation IDs for saving the day for reducing lots and lots of verbiage.

JK Rowling

Most significantly, the winding, labyrinthine twists and turns in the Harry Potter series shore expanded the working memory capabilities of our youth: In a nutshell, their collective attention spans expanded like never before—to keep track of the intricate plots as they unfolded and recursed all over again, our youth’s attention spans had no choice but to expand! Yes, Charlotte’s Web-style, and with the selfsame innocence, some real good came out of those books in addition to creating a generation of granola-munching youth after we had got ourselves the Internet…

Sherlock Holmes

Sigh, the news here is not all that great: With our trusty detective’s penchant for making use of the Interpreter at the drop of a hat—actually a cap in his case— he got himself deeper and deeper into complex grammars that became a nightmare to maintain (Calling Dr. Watson!) You see, our detective found himself in the quagmire of grammar rules (using, ugh, BNF) which required multiple classes: Read that as stuff that’s really, really hard to maintain! Darn (Dr. Watson, where are you when we need you?)

Henry David Thoreau

Oh yes, Thoreau, that city-weary soul really went to town here—no, no, no, not in the literal sense, as he had had enough of the city life, and which had made him retreat the solitude of the woods in the first place. All I’m saying is that the Sage of Concord heroically shielded (his) clients from complexity by erecting a Façade on the shores of Golden Pond, thereby shielding clients from complexity—the fact that he could project his Netflix movies (mostly watching Game of Thrones episodes, actually) on the nearer side of the Façade facing him

Charles Dickens

As a direct consequence of heavily applying the Process Manager pattern, his meandering stories were brought under control, just in time, greatly reducing their size—and complexity!—just as they were starting to show signs of spiraling out of control. Yay! We mortals can barely deal with his boat anchor books in their current form; imagine what life would have been like for us had he not gotten smitten by the Process Manager and decided to apply it to all his novels? Otherwise we would have had on our hands, to take just one example, a volume of his novel Great Expectations) weighing in at something like 75 pounds… Yikes!

The Brothers Grimm

Real simple with our bros: Everybody lived happily, ever-after. End of story, without so much as a smidgen of grimness. Oh my, who would’ve thought! (That’s why Yogi Berra once wisely said that it’s hard to make predictions, especially about the future—and that’s how we got ourselves The 10 Most Intriguing Predictions Ever Made!)

Fav Website

Intro

Well, we couldn’t leave our literary giants hanging high to dry, deprived of their favorite websites, could we? Oh, the callous thought

(Hey, anyone notice the hardcover book above, the one with a black spine, wedged sideways in my bookshelf, bearing the regal emblem of The Oxford University Press and the imposing title Mathematics as a Science of Patterns. Darn. I’m being told to cease and desist from digressing and I was getting ready to tell you all about how that green, gooey spill got itself splattered in their… Sigh.)

My second favorite household chore is ironing. My first being hitting my head on the top bunk bed until I faint.~ Erma Bombeck

But hey, it’s not all that dire. So let’s check out which sites are pals were smitten by, shall we?

Shakespeare

Alcoholics Anonymous (Oops, that would’ve been Edgar Alan Poe’s fav, not the Bard’s!) The incorrigible insomniac that he was, Bill’s fav was—but of course—Counting Sheep. I wonder if he knew that androids dream of electric sheep. But I digress.

Charles Dickens

The Brothers Grimm

Michaels. Every time I walk into that store—a hot fav of craft-lovers everywhere—I can sense the presence of the bros. It’s hard to describe, but the spirit of Brothers Grimm pervades every nook and cranny of the craft store. The bros’ motto: “Make Every Day Vacay“. (I bet it was they who set the precedent for Europeans being on vacation half the year!)

Also Related (But Little-Known)

Intro

Well, your trusty staff here at Programming Digressions—where else?—has taken it upon themselves to resurrect a bunch of curious and little-known facts about are luminaries that will make you think twice before picking on them as being too bookish! (Hint: Let’s just say that they had diverse interests and hobbies…)

And as we consider how algorithms designed for machines might relate to human minds, we also need to look to cognitive science, psychology, economics, and beyond.~ Brian Christian (in Algorithms to Live By: The Computer Science of Human Decisions)

With the little ditty above (about the fugue-like melding of machines and mind) out of our way—I’m not even sure why our staff put the ditty in there—let’s turn our attention to some fascinating facts about our supposedly staid signors and senoritas, shall we?

Shakespeare

Have you ever wondered if the Bard got around to exploring Blockchain, the disintermediation technology that has gripped—and rightly so—the imagination of the industry? (One thing I can tell you is that it sure would’ve made his life easier insofar as tracking the royalties on his plays and dramas is concerned!)

JK Rowling

Did JK Rowling have a thing for recursion, and algorithmic wizardry in general? (Tell you what, ask her yourself the next time you’re in Edinburgh (Scotland). Darn, come to think of it, I should’ve asked her when I was in Edinburgh last October, participating in a conference for the worldwide, software edge computing community that is EdgeX Foundry!)

Sherlock Holmes

Can you imagine our fav sleuth putting on a pair of Google Glasses, that is if anyone remembers that product from a well-known Internet company? (Hmm… Methinks that could work out, except that the form-factor of a Google Glasses pair could well pinch Mr. Holmes’ faces the next he tries to strap it on top of his monocle, you know the one he slips on when he’s in feverish pursuit to storm and apprehend the bad guys? Perhaps Oculus Rift, instead?)

Henry David Thoreau

Will the Sage of Concord (Massachusetts) win a Netflix Prize any day now? (Oh wait, isn’t the Netflix Prize meant to reward improvements in the accuracy of predictions about how much someone is going to enjoy a movie based on their movie preferences? Our buddy Thoreau wasn’t that much into Machine Learning, Deep Learning, and that kind of stuff in general. But when it came to watching movie—lazing on the shores of Walden Pond—nobody could outdo him. So the folks at Netflix just might give him a prize for boosting their sales!)

Charles Dickens

Can our friend the literary legend on the other side of The Atlantic warm up to the virtues of the Functional Programming (FP) paradigm, used as we all are to his highly imperative (OOP) style, spelling his sprawling stories out in excruciating detail? (May I suggest a more declarative style wherein Dickens writes his source whereby he tells his compiler what to do, not how to do it? And while we’re at it, he can go to town and try blending the two paradigms) in a virtuous act of sobriety)

The Brothers Grimm

What are the chances of the Halal Bros, er, the Grimm Bros subscribing to the notion of how Domain-Driven Design (DDD) defies dogma? (If you said, “Slim to none“, consider this: The realms—or domains—of yarns that those pro bros traversed were monumentally diverse. So rather than having the clamor of a Tower of Babel on their hands, with the diverse throngs of people clamoring past one other as they all spoke in their own languages, what they needed was a… Ubiquitous Language, ala DDD parlance!)

Miscellany

Nothing less, and nothing more—a Miscellany this will be—forevermore. So don’t you snore; you lose if you snooze, you know? Or you just might sleep right through a storm! Here, then, are some more tidbits…

I have made this [essay] longer than usual, only because I have not had the time to make it shorter.

~ Blaise Pascal

Oh my, three bright-yellow rings osculating one another, with even more lurking below them! What a knotty problem we see rearing up in front of our very eyes—let’s just hope it’s not a wicked problem!

The writer’s problem is, how to strike the balance between the uncommon and the ordinary so as on the one hand to give interest, on the other to give reality.

~ Thomas Hardy

If you can’t explain it simply, you don’t understand it well enough.~ Anonymous

The road to success is always under construction.~ Lily Tomlin

Afterword

If it squirms, it’s biology. If it stinks, it’s chemistry. If it doesn’t work, it’s physics. And if you can’t understand it, it’s mathematics.~ Magnus Pyke

Speaking of the vast and varied branches of knowledge to which the work chronicled in this essay is but a modest contribution, allow me to wedge in sideways a closing thought. So, just in case—and talking here about only the rarest of the skeptics out there—the thought had crossed your mind that the groundbreaking work presented in this essay lacked a solid foundation, consider this gem from the Gang of Four (GoF), the legendary harbingers of beauty in design and code:

One thing expert designers know not to do is solve every problem from fist principles. Rather, they reuse solutions that have worked for them in the past. When they find a good solution, they use it again and again. Such experience is part of what makes them experts.…

I am thrilled to hear that! You have made my day. Readers like you, Lex, keep me motivated every single day to create more quality content for you all, and also for me 🙂 Thank you, again, for writing a terrific book (Learning Functional Programming in Go, published by the eminently fine folks at Packt Publishing). It’s the book that truly helped me get Go. What more can I say, except just the one thing? Please write even more!

In turn, I love it when readers tell me like it is! Thanks for pitching in with that delightful comment, Edward 🙂 Also, I can’t help but paraphrase George Orwell (from his timeless novel Animal Farm) and add that “all comments are equal, but some comments are more equal than others” 😉 I get a kick out of every single reader comment, and especially so when it’s from a writer extraordinaire who has the distinction of having his most recent book (Plato and the Nerd) having been published by The MIT Press, someone with The University of California at Berkeley (EECS Department), where he’s a Distinguished Professor Emeritus!

Hi there, my name is Akram Ahmad. I’m a Principal Software Engineer in the Research & Innovation Group at Dell Technologies. I am based in Austin (Texas). My focus continues to be on architecting, designing, and developing applications as well as infrastructure for distributed systems. I’m passionate about Java, Go, Scala, Reactive Programming, AI, and perfecting the fine art of programming. Oh, and I’m really into writing, too.

Search for:

Blog Stats

32,755 hits

Recent Posts

Recent Posts

Follow Blog via Email

Enter your email address to follow this blog and receive notifications of new posts by email.