She’d had the idea for a while, but it was only recently that she’d figured out how it could work.
She was surprised it hadn’t been done yet; it was such a simple idea: every commit would append an entry to her work log, letting her review how the work had actually gone. She favoured rebases over merges; they just made more sense to her. But every rebase rewrote history, erasing what had gone on before.
She knew about the reflog—it was what she normally used to piece together her day. But the reflog was inconvenient and it felt like there should be something simpler.
And soon, there would be: she’d learned about Git hooks.
As hackers, we experience the world both as it is and as it could be, desiring through our programs to change it, such that our experience of it meets our expectations.
Programming is a largely (though not wholly) cerebral activity in which our minds perform much of the required labour. In teaching the machines to work for us, bending them to our will, we journey through various realms of thought: the Real, the Abstract, the Absurd, and the Weird. As we navigate these realms and the liminal spaces around them, it can help to recognize where we are so that we may find our way back home.
It is in the The Real that our story begins. It is also in the Real that our story ends.
But first, the beginning.
She decided she’d start with something simple, just test the idea: a bash one-liner that appended the commit message to her work log.
The Real is exactly what it sounds like: it is real life, in which things are as they seem. There are very few surprises in the Real. You’re probably there right now.
An important feature of the Real is that both our expectations and our experience of it are perfectly in sync: the machines behave as they should, what we think is true is true, and we know where we stand. Intellectually, we stand in the Real with both feet on the ground. It is also easy to verify the truth of things, for reality is never far away.
Getting the hook to work was easy enough, but now she had a different problem: formatting. Her work log was written just the way she liked it and doing this in Bash would take too long. It was time to write some Ruby.
Before too long, she had a short Ruby script that understood both which Git hook it was called from and what to do with the information. It was clean and elegant, but more importantly, it worked.
There was just one problem: there was an ugly part that turned the raw commit message into the format she liked. It was several lines of unfactored, brute-force string manipulation that stuck out like a sore thumb amongst the rest of the well-factored methods.
While we generally begin in the Real, we’re always in search of something better. This is, after all, why we program. We usually seek (and find) it in the Abstract, a realm of grounded imagination in which the limitations (constraints) of the Real give birth to new possibilities. It is a land of both creativity and suspicion in which closing one door opens another, possibly to the answers we seek.
It it in the Abstract that we can hear the whispers of a better story for the machines that they might turn our will into a new reality. Re-telling the story still takes place in the Real (where it can have an effect), but in the Real there are no new stories; there are only the same stories told many times over.
Programming, then, is the experience of journeys to the Abstrct and back, retrieving each next chapter of the story and integrating it into the ones we already tell. It is where we find both our bread and our butter, but the knife that unites them is still in the Real.
The Abstract can take many forms and is often a very personal experience. It is possible to meet one another there, usually by describing where we’ve been and wondering if the other has been there too, or perhaps might seek it from a description.
An important feature of the Abstract is that it is still connected to the Real. Anything with value in the Abstract only has value by virtue of its relationship with the Real.
We often stand in the Abstract on one foot, the other resting safely on the ground in the Real. And while we occasionally jump, we should take care not to jump too high, lest we find ourselves suddenly flying, with no feed left on the ground.
When this happens, we find ourselves in the Absurd.
It was almost finished. A custom Ruby formatter as only the beginning. Soon, she’d also added support for ERB templates and a Markdown renderer, all available via a plugin mechanism that was finally coming together.
If the Abstract is defined by its relationship with the Real, the Absurd is defined by its lack of relationship. No longer rooted on the ground, a trip through the Absurd can take us to all sorts of weird and wonderful places.
The problem is that the Absurd no longer has any bearing on the Real, to which we eventually desire to return. Journeys through the Absurd often resemble journeys in the Abstract, except that when we forget to check our feet, we no longer know which way is up. In the Absurd, not only is everything possible, it often feels quite within reach!
It is not a problem to journey into the Absurd once in a while; it can help us explore new reaches of the Abstract and percive higher peaks. But when we mean to get something done, the Absurd is not where we wish to end up. In our flights of fancy, we often forget that we came here seeking a better life in the Real, only to find ourselves floating far away from where we wish to end up.
Far from edifying, what we bring back from The Absurd are tales told by idiots, full of sound and fury, signifying nothing.
Okay, so the plugin system had been a bad idea. After a bit of creative rebasing, she was back with ad-hoc formatter and a couple of Git hooks from which to run it.
Confidently, she added an empty commit, expecting it to show up in her work log as before, but nothing happened. She frowned and tried again. Nothing. She added a third commit, this in ALL CAPS, in case yelling would help. Still nothing.
What the heck was wrong? The entries had been appearing in her work log until now; what was different?
Unlike the Absurd, the Weird very much represents the Real, except that it is not. Something about it is off, contradictory, wrong. In the Real, everything makes sense. In the Weird, most things make sense, except for where they do not.
We usually fall into the Weird as a result of some accidental or hidden assumption being violated. What makes the Weird so peculiar is that unlike in the Absurd, there are no ideas to fall in love with, no dreams of a better universe. Instead, we are faced with a pseudoreality that does not resolve.
Of course, reality is fine; it is we who are off. But since we do not know what we do not know, the only way to find our way back to the Real from the Weird is to carefully retrace our steps until we find that which tripped us in the first place. Sometimes we need to ask for help getting back.
There is always a way back to the Real, but finding it can be maddening.
She looked at the clock. It was after midnight, 12:07. She wanted to go to bed. But first, she had to figure this out.
After midnight… then it hit her. The utility scripts for managing her work log rotated it every day. She realized then that the work log she’d been monitoring this whole time was no longer the work log for today; it had become the work log for yesterday.
She mashed ^C to end the tail session, checked the directory, and sure enough: a new work log had been added for the new day. Printing its contents revealed the entries she’d expected, perfectly formatted, including the last commit message in ALL CAPS.
Her code had been working fine, dutifully doing what she’d written it to do. She’d just accidentlly stopped looking in the right place.
Grinning, she closed her laptop and went to sleep.