There’s this moment in Sandi Metz’s conference talk, All the Little Things, where she describes a process of squinting her eyes and looking at code as it blurs in the field of one’s vision. Just the outlines, just the shape of code. For Metz, looking at code through squinted eyes provides a tool for gauging its complexity, for seeing how conditional logic creates peaks and valleys for our minds to circumnavigate as we try to understand it.
The squint test is a kind of formalism – a way of thinking about structures and patterns distinctly from how we think about content. Form and content are always intertwined but our minds often tend to focus on content first. In terms of code, I tend to be thinking about what the code is trying to do as I read it.
Shapes, outlines, systems – they all become more apparent once I squint my eyes and stop following the thread of the content. A formal lens such as the squint test abstracts the what and emphasizes the how.
In writing code, Sandi Metz emphasizes how we can use a formal perspective to remind ourselves to build smaller and simpler functions. In the process of breaking complex logic down into its most modular parts, we find errors and problems, we expose new patterns that were buried under nested conditionals. And we make it easier to reason about each of those small parts.
My frame of reference for thinking about formalism was not code but the study of literature. In grad school, my colleagues had talked about the form of a poem or a novel in a reverent tone of voice – as if they were talking about its spirit. The form of a work of literature could be something elusive and difficult to grasp or it could be its use of rhyme and meter, its genre, its metaphors, or even the way it takes up space on the page.
•••
Doing something like the squint test on works of literature also reveals the general tendencies of a text – does it contain long complex run-on sentences or short simple sentences? Is it rhythmic, composed of small similar things? Does it branch into a hierarchy of elements or does it flow into multiple streams? Is it predictable or is it chaotic, jumping from one line to the next without rhyme or reason?
There’s something reductive about formalism – one doesn’t exactly read a poem for its shape on the page (unless, I suppose, it’s a concrete poem) – but formalist reductionism often reveals some new aspect of a thing by (often temporarily) occluding its content.
I have often seen formal literary readings follow a pattern of first occluding the content of the text to highlight the formal device under scrutiny and then selectively reintroducing themes or other aspects of the content and then finally highlighting the relationship between the two.
•••
You could squint at hundreds of sonnets, make out their general similarities and differences from one another, the way a sonnet tends to fit perfectly to a page, the way one can take it all in at a glance. You could squint and look at the slight variations between similar sonnets.
At this point, we’re doing something that (arguably) machines do better than us. Human minds can delve deeply into a single text, make connections between it and other domains, draw out interpretations. But machines can analyze thousands or millions of data points and grasp elusive patterns.
These days, it’s common enough to see machine learning models trained to write sonnets or compose music by recognizing the structures in a data set and creating something new that follows similar rules.
It makes me think that computers might be better formalists than humans – at least when dealing with large volumes of standardized data (an important caveat!). The very notion of formalism alludes to logic and patterns, to programmatic thinking. Yet I imagine that most of the scholars that I met in grad school would resist the idea that computers would have any insight into the formal qualities of a work of literature.
•••
If we imagined a venn diagram of poetry and code:
The last point is a bit obscure. What I mean by this is that a poem is a singular utterance, the distillation of a subjective expression, a single atomic fragment of the universe. A poem speaks to an experience or a moment. But what makes a poem a poem is that as it inhabits its singularity, it gestures toward the world and constitutes a unique relation to that world.
The poem constitutes a relation that I don’t exactly want to characterize as “universal and particular” because the concept of the universal is fraught with imperialism and much contested ideology but let’s just say that the existence of the poem, its aesthetic imperative, implies that something can be generalized beyond the bare facts of the words on the page and beyond the experience of the poet. The poem describes not just an experience but a world.
A function – a bit of code – starts with the reproducibility of logic rather than the singularity of data. One of the things that makes code powerful is its ability to encapsulate such repeatable logic. But a function takes the singular, individual, stray fragment of the world as its input. A function is its own reproducibility. Its world is a set of rules, when X goes into the black box, Y comes out of it.
The function takes the singularity of its input, a particular number sequence or a particular word or bytes, and it always does the same thing to it. But while the poem (often) starts with singularity and generalizes, the function starts with generality and uses it to process singularity. They both constitute versions of formalism – they provide occasions to occlude content and gesture toward patterns.
It is our mind’s interaction with formalism in both domains that synthesizes forms and singularity into something unique, playful, shared, and wild. Our minds are not machines, so we make meaning out of the tension between repetition and difference.