I’ve had this idea kicking around for a while, and I’ve decided that I don’t want to do it. But I think it would be, quite likely, a very popular idea. So I’d though I’d throw it out, and if anyone else wanted to do it, they can have at it.
The basic idea is this: the vast majority of people who are using databases at this point don’t really want a database. Specifically, they don’t care about the relational calculus or SQL, and indeed are going to great pains to hide the fact that these even exist. Let alone take advantage of them.
What they really want is a shared persistent object store that takes care of synchronization issues.
So give it to them. Ideas on how to do this after this short commercial break.
The first thing is, when I say an “Object store”, what I really mean is a tuple and blob store. A tuple, in this context, is an arbitrary ordered collection of values with associated types (int, string, float, etc.). A tuple can also contain references to other tuples as members, and so on. Note that all typing (to the extent types are checked at all) is dynamic, and each tuple has it’s own, unique, type. This makes it very easy to mix and match types- for an example, in the program it may be an array of GeometricObject types, which can be elements of either Lines (four variables) or Points (two variables). In the tuple store, it’s just a single tuple containing references to other tuples, some of which are tuples of two floats (the points) and some of which are tuples of four floats (the lines). The advantage of this sort of object model is that just about any other object model can be layered on top of it.
Each tuple should have a unique identifier. Which allows a program to request a specific tuple without have to figure out a search query for it. Which is good, because programmers don’t want to write search queries in other languages, to be executed somewhere else. If they did, they’d be using SQL (this is one thing SQL is really good at- doing sorting and searching for you). No, if the programmer wants to find an object in a table, they’re write a quick for loop to walk down the array (tables are arrays, don’t you know?) looking for the right object.
For synchronization, I’d steal a leaf from the hardware engineers and implement a MESI protocol. Each object that is backing stored is in one of four states: Modified, Exclusive, Shared, or Invalid. An Invalid object is one where the tuple data is not stored locally, and before the object can be either read or written to, it has to be first fetched from the server. Shared objects are objects where the state is current locally, but other copies can exist in other programs- in other words, the object can be read but not written to. Exclusive objects have been locked to the local program- they can be written to, but haven’t yet. In other words, the state locally and on the server is still the same. Modified objects are objects that have had their internal state changed locally, but these changes have not been pushed back to the server.
The important idea here is that communication works both ways- state changes can be initiated by both the program and the server. The program can ask the server (or tell the server) to upgrade or downgrade it’s state- for example, a function which modifies the object’s state could upgrade a Shared object to an Exclusive object, before performing the modification- sending a message to the server. The server could then send a message to the other programs that also have shared instances of that object, asking them to downgrade their status to Invalid, before replying “OK, you’ve got the object exclusively”. Some time after the modification to the object is made, the server can then request the Modified object be downgraded to, say, shared- at which point the program needs to update the state of the object on the server. Clever library writers should be able to handle this protocol automatically using decorators- but that’s a language dependent issue.
The last feature required is absolute, brain-dead simplicity to install. If you have to read more than a page of information, and spend more than half an hour to set up and tune an installation, that’s too complex. And any maintainance requirements more complex that a nightly backup of the files is too complex. Heck, count yourself lucky if they bother to back up the files every night.
So that’s the idea: the crowd is headed off that direction anyways, you might as well follow from in front and declare yourself a leader. I’ve thought about it, and this is just not an idea I’m interested in pursuing. So here it is- I present it to you gratis.
If people are interested, I might do a post on some of the things wrong with the idea.
No related posts.
Pingback: Enfranchised Mind