About This Site
> Concepts for Persistent Objects
Language Design Principles
Instances and Copies
Synchronization and Merging
In the previous essay, the discussion was restricted to objects that one doesn't normally edit, i.e., to objects considered as static entities. Now let's start looking at what kind of things can happen when objects are considered as dynamic entities. So, suppose we have an object, that is, a set of identical instances.
Just to be specific, suppose the object is a fairly large text document of some kind—perhaps a legal document, an automobile insurance contract—and that there are lots of instances. Now suppose we need to make some change to the document. Maybe there was an error in the original, typographical or otherwise, or maybe a new law mandates a particular wording in some clause. In any case, we edit the document and produce a new version.
The old version continues to exist, of course—thousands of printed instances have been mailed to consumers and duly filed away.
Just for fun, suppose we later edit the document again.
Now, here's the interesting thing. Although there are three slightly different versions of the contract, we still think of it as the contract, as a single object. The three filled-in dots, corresponding to the three sets of identical instances, turn out to represent versions, not objects. (We couldn't see this in the static case, because there each object could be identified with its single version.)
That's the main point I wanted to make, that filled-in dots represent versions. To make the point clear, I had us imagine an object in the limit in which the versions are only slightly different and there are lots of instances of each version. There's another limiting case that's worth imagining, though, and that's the case in which there is only a single instance of the object—typically, just a single file on disk.
What happens when one edits such an object? Later we'll go through this example in detail; for now let's just imagine that the single instance is suddenly replaced by a new, edited instance. Now, although we still possess the idea of the old version, in some important sense the old version doesn't exist, since there are no longer any instances of it. In other words, the old version is no longer extant. (That's exactly the right word.)
I'd like to claim that in this situation it's reasonable to continue to include the old version in our thinking, to regard it as a version with zero instances rather than a nonentity. I managed to confuse myself for some time on this point, so I figure it's worth discussing at length, as a preemptive strike against similar confusion in others.
There are two different things going on. First, although it's so normal that we aren't even aware of it as such, we think about things that don't currently exist all the time. We think about things that existed in the past, or that may exist in the future. We even think about things that can't possibly exist, that are internally inconsistent. So, thinking about a version that no longer exists should present no difficulty at all.
Second, a version is an abstraction, a concept, not a tangible entity, so talking about its existence or nonexistence is pointless. (One might as well argue about whether the color red exists!) In the example above, consider the moment just after the single instance of the old version is replaced. Does the old version, with its single instance, no longer exist, or does it still exist, but currently have no instances? I claim there's no difference between the two alternatives. It sounds like there's a difference, but that's just an artifact of language.
The point about versions being abstractions is particularly easy to miss, because we're used to thinking about physical objects. Each physical object has only one instance, so naturally we tend to identify the object with its instance, which is tangible, rather than with its series of versions, which is abstract. It's the latter point of view that is correct, however. This is most evident in living organisms, in which cells are continually dying and being replaced, but it's true even of inanimate objects, which are always losing a few atoms here and there.
Example, An (Concepts for Persistent Objects)
@ September (2000)