Hackernoon logoThe Poet and the Variable by@davedrew

The Poet and the Variable

David Drew Hacker Noon profile picture

David Drew

Frontend engineer

Developers often talk about software’s “most difficult problems”: cache invalidation and naming things. It’s a tongue-in-cheek joke with a lot of truth. It’s very difficult to take an abstract concept and boil it down to a single name, and that’s something that developers have to do constantly in their day to day work. Be it code they write or talking to a colleague or a group, one of the most important things a developer can do is learn to articulate abstract ideas—so important in fact, it’s often something that’s tested in interviews.

As someone who started their career in journalism, I’m prone to spending a lot of time thinking about what to name a variable in a piece of code, or a concept in a framework or tool I’ve written. Summarizing a complex visual or abstract idea into something we already understand is not just something I enjoy doing, it’s an incredibly efficient way to relay information.

If we talk about verbal or written communication in terms of bandwidth, and a word as a packet, a single word can communicate a vast cosmos of not just ideas, but emotions and imagery in single unit of transmission. Poets and songwriters know this quite well.

A Noiseless Patient Spider by Walt Whitman
A noiseless patient spider,
I mark’d where on a little promontory it stood isolated,
Mark’d how to explore the vacant vast surrounding,
It launch’d forth filament, filament, filament, out of itself,
Ever unreeling them, ever tirelessly speeding them.
And you O my soul where you stand,
Surrounded, detached, in measureless oceans of space,
Ceaselessly musing, venturing, throwing, seeking the spheres to connect them,
Till the bridge you will need be form’d, till the ductile anchor hold,
Till the gossamer thread you fling catch somewhere, O my soul.

If you were wondering, a “gossamer” is defined as “a fine, filmy substance consisting of cobwebs spun by small spiders, which is seen especially in autumn.” In one word, Whitman ties together the concept of a human casting their attention and “soul” into the world to find meaning for themselves with a literal spider spinning its web. That’s positively miserly with words.

Most software engineers I’ve worked with are content to keep an abstract concept named abstractly, and simply internalize its meaning. In Javascript, there is a concept of an “object”; an actual specific thing that exists in the language that is of great importance, yet is represented by a word so broad in meaning as to be obtuse to anyone who doesn’t already know the term.

In traditional parlance, an “object” is considered to be a thing, being, or concept. So, essentially any damn thing. In software, the term arises from computer science, and is meant to describe something that has an address in memory and a value associated with it (this can mean variables, functions, methods or data structures). Yet “objects” in Javascript have very real characteristics. They are a data structure that associates things to strings, those things being actual values (strings or numbers) or references (other objects or arrays).

If you’re not familiar with Javascript or its “object” type, this is probably all a bit esoteric. Let’s create a metaphor that describes exactly what an object looks like using an idiom we’re all fairly familiar with: a cabinet.

Let’s say you’re standing in front of a cabinet:

let cabinet = {};

With a shelf for shoes (“shelves”, by the way, can hold anything a cabinet can! We call them “arrays” in Javascript and most other languages):

let cabinet = {
shoes: ['boots', 'sneakers', 'climbing']
}

With some duct tape sitting on the floor (it’s very disorganized):

let cabinet = {
shoes: ['boots', 'sneakers', 'climbing']
duct_tape: true
}

With a very derivative piece of writing sitting next to the duct tape:

let cabinet = {
shoes: ['boots', 'sneakers', 'climbing']
duct_tape: true,
derivative_work: "It was the best of cabinets, it was the worst of
cabinets..."
}

With my age (D’oh!)

let cabinet = {
shoes: ['boots', 'sneakers', 'climbing']
duct_tape: true,
derivative_work: "It was the best of cabinets, it was the worst of
cabinets..."
age: 33
}

And, get this: there’s even another cabinet in there, with its own plethora of junk inside.

let cabinet = {
shoes: ['boots', 'sneakers', 'climbing']
duct_tape: true,
derivative_work: "It was the best of cabinets, it was the worst of
cabinets..."
age: 33
another_cabinet: { ... }
}

So that’s it. We should call Javascript objects “cabinets” right? ;)

My goal isn’t to piss off every Javascript developer in the world by proposing we change what we call “objects” to “cabinets”, rather to ponder on how effective naming can be at describing an abstract concept. Software, like any other discipline, has a unique language that communicates, with high bandwidth, very specific ideas.

But that doesn’t mean it has to rely on jargon for explanation.

My guess (or hope) is that someone who was not computer literate reading this article would, by the end of it, be able to describe a Javascript object as “a cabinet that can hold writings, numbers, things, shelves and other cabinets,” — in which case they would not be far off. They might even know of someone with a similar cabinet structure, and say, “Yeah, Javascript objects are like Uncle Jim’s garage cabinet,” and everyone in the room who knew Uncle Jim would nod in a knowing manner.

And that, really, is the sharpest use of language: when you can use an idea or image you know the audience has great familiarity with to convey an idea. Our goal, just as with any writer, is to clearly elicit an idea using metaphor, with our audience in mind, and this changes from place to place and time to time. Sometimes it’s Uncle Jim’s cabinet, sometimes it’s a spider in Uncle Jim’s cabinet and sometimes it’s a gossamer of being.

Edited by Kristina King

Hacker Noon is how hackers start their afternoons. We’re a part of the @AMIfamily. We are now accepting submissions and happy to discuss advertising &sponsorship opportunities.
To learn more, read our about page, like/message us on Facebook, or simply, tweet/DM @HackerNoon.
If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!

Tags

Join Hacker Noon

Create your free account to unlock your custom reading experience.