Object Persistence Using a File System

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Wed Jul 19 01:45:21 EDT 2006


In message <1O%sg.3749$wZ.3322 at trndny01>, Chris Spencer wrote:

> I've been looking for a method of transparent, scalable, and
> human-readable object persistence...

Don't do object persistence. What is an object? It's a combination of code
and data. Code structure is internal to your program--it has no business
being reflected in external data that may be saved to a persistent medium,
transmitted over an external channel or whatever. Otherwise when you
refactor your code, that external data no longer becomes readable without
major backward-compatibility hacks.

Use data abstraction instead: define a high-level data structure that is
independent of implementation details of your code. When you look at the
major data-interchange formats in use today--such as XML, ODF, MPEG,
WAV--there's a reason why none of them are built on object persistence.



More information about the Python-list mailing list