Search code examples
databaselanguage-agnosticobject-persistence

Implementing Transparent Persistence


Transparent persistence allows you to use regular objects instead of a database. The objects are automatically read from and written to disk. Examples of such systems are Gemstone and Rucksack (for common lisp).

Simplified version of what they do: if you access foo.bar and bar is not in memory, it gets loaded from disk. If you do foo.bar = baz then the foo object gets updated on disk. Most systems also have some form of transactions, and they may have support for sharing objects across programs and even across a network.

My question is what are the different techniques for implementing these kind of systems and what are the trade offs between these implementation approaches?


Solution

  • I've used such a system (ObjectStore) on several projects, most notably a commercial credit risk system, and a system for optimising flow in oil pipeline networks. The question about implementation is too complex to discuss here, but as for trade-offs between such systems and relational databases:

    Object DB advantages:

    • very very fast - for some queries they can be 100 to 1000 times faster than a relational database. In fact the risk system I designed could not (according to Sybase themselves) be implemented on a SQL database.

    • very easy to integrate with C++ code - no impedance matching layers needed.

    • limited number of GUI libraries available for bread-and-butter CRUD apps

    Relational advantages:

    • ad hoc queries much, much easier and faster than for Object DBs.

    • about a million tools to manage the database

    • very easy to create GUI apps

    • lots of people have RDBMS experience

    But of course, as with all tools, you don't have to choose one. The risk app I wrote imported data from a Sybase database, and the pipeline from Oracle.