Working Memory for the Working Programmer

0 b.png

We are perishing for lack of wonder, not for lack of wonders.
~ GK Chesterton

Intro 🍎

Check that crumpled-looking scratchpad in the pic above—the one impaled by a red paperclip even as it gets singled out by Adam Smith’s “invisible hand”—hovering above our wonderstruck lad’s head? Ah yes, right there we have the essence of the wonders (and attendant befuddlement) that accompany any mention of this critter called “working memory”.

Brah, I wasn’t kidding either when I called out the “scratchpad metaphor” in the same breath as working memory. But we’re getting ahead of ourselves (If you truly can’t help yourself—curiosity is getting the better of you—then look up why it’s cool to find out more about our mental scratchpad.)

Meanwhile, taking a page (lyrics) from the tunes of Smokey Robinson, let’s take this one heartbeat at a time, starting with this decently-daffy definition:

Working memory is a system for temporarily storing and managing the information required to carry out complex cognitive tasks such as learning, reasoning, and comprehension. Working memory is involved in the selection, initiation, and termination of information-processing functions such as encoding, storing, and retrieving data.

As if that mouthful isn’t enough, they throw the following in just for good measure:

One test of working memory is memory span, the number of items, usually words or numbers, that a person can hold onto and recall. In a typical test of memory span, an examiner reads a list of random numbers aloud at about the rate of one number per second. At the end of a sequence, the person being tested is asked to recall the items in order. The average memory span for normal adults is 7 items.

Oh, did I tell you about the fine researcher-lad Alan Baddeley‘s use of the metaphor dealing with a company boss to describe the way in which the central executive operates? So…

gator b.png

Hey, Come Back! 🚴

Don’t run away. At least, not quite yet. We’ve barely begun, you know.

Plus we’re talking crucial stuff here. Stuff that’s indispensable for carrying out knowledge work; basically, the stuff that most all of us do nowadays, most all of the time.

As related to those of us who are practitioners of the art of computer programming, check what legendary Lisp hacker Paul Graham has to say about working memory—the foundational stuff that it undeniably is—in his brilliant and highly readable book Hackers & Painters:

This is why hackers give you such a baleful stare as they turn from their screen to answer your question. Inside their heads a giant house of cards is tottering.

For a bit more—and we really should let Paul Graham complete his thought—let’s turn to that giant house of cards which is on the verge of tottering.

Check this. KABOOM!

cards b.png

Good Enough For Now, Yeah? 🎬

Different kinds of work have different time quanta. Someone proofreading a manuscript could probably be interrupted every fifteen minutes with little loss of productivity. But the time quantum for hacking is very long: it might take an hour just to load a problem into your head. So the cost of having someone from personnel call you about a form you forgot to fill out can be huge. This is why hackers give you such a baleful stare as they turn from their screen to answer your question. Inside their heads a giant house of cards is tottering.
~ Paul Graham (in Hackers & Painters)

Cool. I, too, think it is.

(Warning: Don’t try that playing cards experiment at home. At least not quite yet; those innocuous looking cards might slice through your hands like machete blades. Okay, okay, just kidding. Some people ain’t got no sense of humor. Sheesh!)

So let’s move on to more serious business, such as railway tracks. All aboard.

1 b.png

All Aboard (For Some Erudition) 🚂

I’ve been working on the railroad
All the live-long day.
I’ve been working on the railroad
Just to pass the time away.
~ I’ve Been Working on the Railroad (from Carmina Princetonia, a book of Princeton University songs)

Such erudition on display in those trenchant lines of verse. So complete a mastery of the railroad jargon. Oh my!

Yep, that can’t be beat. Jujitsu style, though, let’s take in the pic—the one right above the verses of rhyme—and focus on the conjoining and switching among the mesh of railroad tracks.

That’s right. We cook up, let’s say, an algorithm in our head, adding in the details, bit by bit—or “thimbleful by thimbleful”, as Nicholas Carr memorably puts it in his superb book The Shallows: What the Internet Is Doing to Our Brains. It’s in the switching between contexts that we programmers make gold, if you will allow a wee digression into the story of King Midas and his touch.

Hey, did anyone even notice the pachyderm—that’s simply an elephant, for folks like you and I—which I had surreptitiously planted alongside the railroad tracks? (Yo, come to think of it, does anyone ever notice the dainty borders that I put around the pics in essays such as this one and which, needless to say, I cull from the public domain?)

Anyhow, with a cranium the size of an elephant, that lumbering dude must have an enormous working memory? Conjectures ahoy. Anyone.

2 b.png

Behold The Bezier-Mesh Cranium 👓

Every man’s memory is his private literature.
~ Aldous Huxley

Anyhow, and setting conjectures (about elephants boasting enormous working memory) aside for a minute, a ton of scientific studies have dissected the workings of working memory six different ways.

Oh yes. And prominent among them is the work of Philip Johnson-Laird—for an engaging account of (some of those) scientific studies, I can recommend that you look up his fine book entitled How We Reason (Oxford University Press).

Hey, did anyone even notice the button hovering above the bezier mesh cranium in the pic above—along with a flaming red cookout barbecue on the grounds—which is to symbolize The Curious Case of Benjamin Button, a witty and fantastical satire about aging (with the accompanying effects of the passage of time on memory.) Oh yeah, while that guy F. Scott Fitzgerald is mostly known for his novels, he sure knew how to spin a yarn, too.

Wait. We’re not doing Lit; at least not right now, since we did it back then.

Meanwhile, you feeling adventurous enough to upload new skills directly to the brain? Just like in the film The Matrix, using those plug-and-play cartridges (check the pic below.) Aha, let’s see what this hopping, little bird has to tell us…

3 b.png

Memories Are Made Of This 🎭

There’s no time to lose, I heard her say
Catch your dreams before they slip away
Dying all the time
Lose your dreams
And you will lose your mind.
Ain’t life unkind?
~ The Rolling Stones (from their song, Ruby Tuesday)

Human memory is about to get supercharged. Or is it? I mean, are you ready to upload new skills directly to your splendid cranium, just like in the film The Matrix? I bet you are, considering the plentiful demands on your copious, free (!) time:

What is that you say? Ah, good, so you’re going to take a number and get in line for your very own upload of skills straight to your cantankerous cranium.

And should you wish to pursue this even further—in the spirt of how The future is already here; it’s just not evenly distributed ala William Gibson—then you owe it to yourself to read up on this article at NewScientist about how Matrix-style memory prosthesis is set to supercharge the human brain.


4 b.png

Strolling Down Memory Lane 🐢

We are what we remember. If we lose our memory, we lose our identity and our identity is the accumulation of our experiences. When we walk down the memory lane, it can be unconsciously, willingly, selectively, impetuously or sometimes grudgingly. By following our stream of consciousness we look for lost time and things past. Some reminiscences become anchor points that can take another scope with the wisdom of hindsight.
~ Erik Pevernagie

The quote above, along with the accompanying pic of the stroll itself will, I hope—in the spirit of the vaunted Reader’s Digest monthly column Toward More Picturesque Speech—suffice to paint a complete picture.

Enough said.

5 b.png

Incipient Memories 🐉

We are now, shall we say, no longer on terra firma (aka “here be dragons“.) Check the memory vortex above: Methinks this is looking more and more like a lurching lunge into the dungeon of nascent memories, something right out of the harrowing movie Incipient.

Speaking of which, and according to an AI-focused issue of The MIT Technology Review (Oct 26, 2018), a controversial artwork created by the juggernaut that is AI hauled in $435,000 at an auction. That’s a lot of dollars, if you ask me, for a mere lunge into the workings of working memory!

Dollars or no, I’m out of here before I get swallowed by that harrowing dungeon: AARGH!

6 b.png

Trouble, On Tentacles 🐙

Row row row your boat,
Gently down the stream.
If you see a crocodile,
Don’t forget to scream.
~ Row, Row, Row Your Boat (a popular, nursery rhyme)

Yeah boy—yes, that’s you, faux gondolier, suspenders and all—while you’re busy pointing out to your unsuspecting gondola-bearing guests the blithering and slithering deep sea angler fish that has surfaced (likely checking out the newly-opened strip mall along the leafy banks of the fine River Thames), do you mind turning your head to the other side of your gondola?

Yikes. The “green-eyed monster” itself! Come to think of it, it’s all green, and not very friendly either.

Yeah, brah, I was trying to tell ya: We got moh trouble at starboard.

And this ain’t our friendly, tentacled mascot from EdgeX either.

That’s why I keep telling you (and myself!) that it’s good to learn how to chew gum and walk at the same time. And while you juggle the implications furiously—we’re trying to save our imperiled lives here, in case you didn’t notice—let me point you to the finest when it comes to reaping the results of searching high and low for the gestalt of working memory:

The Ravenous Brain: How the New Science of Consciousness Explains Our Insatiable Search for Meaning by Daniel Bor (Basic Books)

What. A. Book.

ml b.png

Speak Memory 📣

For anyone still scratching their head, wondering where the unearthly title of this essay—”Working Memory for the Working Programmer”—came from, I can now help. Check the pic above: You’ll spy an eminently eco-friendly-green book with the bold title ML for the Working Programmer, a book which I bought many moons ago, back when I was tackling the Cambridge University Press’ Purely Functional Data Structures by Chris Okasaki.

But wait… OMG! Is that Ms. Owl herself, perched atop our copy of the eco-friendly-green book? Gulp, anyone even remember our adventures when Ms. Owl used to flutter right over to the side of Mr. Jowl—our very own gopher from GopherCon 2019 in San Diego—and perch herself demurely on the front-right tire of his oh-so-stylish Go-mobile.

Well, what do you know! Ms. Owl is back, looking positively giddy. Help!

And we’re done. More like, we’re done for. Or something; that’s for sure.

Oh, speaking of memory, brownie points for anyone who spots Vladimir Nabokov’s Speak, Memory: An Autobiography that’s suitably anchored, weighed down—inveighed eh, heh heh?—by ML for the Working Programmer.

I’m telling you, memory can be elusively sieve-like at times… I turned to look but it was gone, I cannot put my finger on it now. The child’s grown, the dream’s gone: POOF!

Which is why, of course—what with Sherlock Holmes having bit the dust many moons ago—we’re sending for the finest detective services money can buy nowadays. Read on to find out.

8 b.png

Send For Our Top Detective 🔭

Of course it’s very hampering being a detective, when you don’t know anything about detecting, and when nobody knows that you’re doing detection, and you can’t have people up to cross-examine them, and you have neither the energy nor the means to make proper inquiries; and, in short, when you’re doing the whole thing in a thoroughly amateur, haphazard way.
~ A.A. Milne, The Red House Mystery

That would be Monsignor Parrot, of course, suitably disguised to blend in with the natives. Yo, craven Mr. Toucan, how did you flutter into our pic? You’re supposed to be overseeing culinary efforts, baking all those cakes and pastries, for crying out loud. Yeah, you’re fetching—or something—but can you, like, stay out of hush-hush photos involving sleuth work of the utmost sensitive nature?

7 b.png




  1. Akram, a wonderful ‘digression’ as always! Certainly, you make a good argument, hacking + anything requires one to be a bit of a coding contortionist.

    There beyond (or before) what we classify as memory exist: natural instincts, a first kiss, and the way our hearts beat without us even having to ask.

    I’ve always found the ability to create new things, for instance on (or with) a computer, super-fantastic! Let us take this moment to thank our thumbs for remembering which is right and which is left.

    Thank you for reminding us that we can enjoy Archimedean solids, and logic gates, and dogs playing poker; if not always simultaneously… =D

    Mnemonic nod’s must be given to:

    “…” -Silencio (All Tomorrow’s Parties, by William Gibson)


    “I use the Pensieve. One simply siphons the excess thoughts from one’s mind, pours them into the basin, and examines them at one’s leisure. It becomes easier to spot patterns and links, you understand, when they are in this form.” -Albus Dumbledore (Harry Potter, by J.K. Rowling)


    “He has the tidiest and most orderly brain, with the greatest capacity for storing facts, of any man living.”-Sherlock Holmes (The Adventure of the Bruce-Partington Plans, by Sir Arthur Conan Doyle)

    • Wow, Matt, you’ve just laid out the wondrous nature of creativity itself; the endeavor and the enterprise lean on a back-and-forth between the right brain and the left, trampoline style! I couldn’t have put it any better, which is just as well, proving that you are the creativity czar around here 🙂

Your Comment Here!

This site uses Akismet to reduce spam. Learn how your comment data is processed.