This post is a continuation of the prior one, but won’t yet deliver on showing a direct connection between transactions and the kind of thinking we typically call mathematical thinking.
In the previous post, I introduced the idea of a transaction as a whole consisting of pieces being brought together, in a particular way. At a particular point, either the transaction commits – in which case the whole is produced and none of the pieces can back out, or else the transaction is able to be rolled back in which case the situation is restored to the way it was before the transaction started. The idea of a transaction allows us to face the uncertainty whether all the pieces will in fact come together, and deal with it in a systematic way.
The examples in the prior post all dealt with multiple parties that may not fully trust each other. In this post, I want to show examples of transactions involving a single party, but in the presence of distractions, disruptions, interruptions, and similar kinds of uncertainty.
My first example will involve taking pills. Let’s say there’s a certain pill I’m supposed to take once a day, before meals. Let’s assume that on any given day, it would be bad not to take the pill, but also bad to take the pill twice. Let’s also assume that I’m a forgetful kind of person, and not reliable in remembering whether I have taken my pill for today already. In this situation, I clearly have some need for keeping careful track. A simple way to deal with it would be to make it part of a routine, e.g. make it part of a routine that includes brushing my teeth first thing in the morning. This works reasonably well. Come to think of it, my routine of brushing my teeth is itself vulnerable to my poor memory. Let’s suppose I am about to brush my teeth when the phone rings. I pick up the phone, have a conversation on the phone, and go back to the bathroom. Did I or didn’t I already brush my teeth? Well, if I’m in doubt, I’ll simply brush my teeth – there is no risk in brushing my teeth an extra time.
Here is a sketch of a routine that incorporates these ideas:
1. Open the drawer and leave it open.
2. Take out tooth brush, tooth paste, pill bottle, and put them all on the counter.
3. Take pill out of bottle.
4. Take the pill. After the pill has been taken, the bottle goes back in the drawer.
5. Brush teeth. After teeth have been brushed, tooth paste and tooth brush go back in the drawer.
6. (a place holder for right now)
7. Close the drawer.
If an interruption or distraction occurs, once I get back to the bathroom, the open drawer and the stuff on the counter tell me all I need to know to continue appropriately. Whether I proceed correctly is not a function of me remembering precisely where I left off. The open drawer is a strong trigger for me that something was left incomplete, and the stuff on the counter is an easy and tangible way to track what is left to be done. It isn’t even necessary to remember exactly in which order to do things: step 5 could come before step 3 or before step 4 with no damage done. The only things I need to remember are relatively obvious ones: opening the drawer is the very first thing, and closing it the very last, and all things are to be laid on the counter before doing any of them. You can see how this routine protects me from taking the pill multiple times. If my routine involved more activities, e.g. more than one kind of pill to take, it would be easy to extend the scheme appropriately.
The scheme is set up to leave things in a place ready for tomorrow’s routine to start. This is both good and bad. When I walk into the bathroom and find the drawer closed, I have no certainty from that alone whether I have done my routine for the day yet. Since the routine involves so many steps, it is less likely that I would forget having done all of them, but it is a flaw in its design. To fix this flaw, I could substitute the following for step 6:
6. Put a check mark on my calendar for today’s date.
I’m giving you this example, because it is a real-life example, not because it is the best or the only way to organize things. A common way to organize pill taking is through one of these:
This design relies on filling the container once a week, and always knowing what day of the week it is.
I’m thinking of my pill taking example as an example of a transaction as introduced in the prior post. This may seem strange to you, because there is no such thing as un-taking a pill, and so it may seem there is no possibility of roll back. It is true that this example is primarily organized to make sure we can always roll forward. Yet if we look closely, we can see that the commit point is right after step 2, before step 3. If in step 2 we found that the pill bottle was empty or the tooth paste tube was empty, we could still roll back and deal with those issues. Specifically, we could put everything back in the drawer, and close the drawer, and then go find the supply cabinet with extra tooth paste tubes. That would eliminate the scenario of getting distracted, coming back to the bathroom and, having forgotten what happened so far, proceed dealing with the stuff laid out on the counter and thus missing taking my pill or missing brushing my teeth.
The idea of organizing a task involving multiple steps so it can be rolled forward regardless of distractions and interruptions (or can be rolled back cleanly) without reliance on short-term memory – this idea becomes increasingly important the less trivial the task is. This is the form of the idea of transactions that I’ll attempt to connect to mathematical ideas.