POOP / Python (Object Oriented Persistence) ?

Dirk-Ulrich Heise hei at adtranzsig.de
Thu Jul 13 03:23:34 EDT 2000


"Andrew Kuchling" <akuchlin at mems-exchange.org> schrieb im Newsbeitrag
news:3dwviszl99.fsf at kronos.cnri.reston.va.us...
> "Dirk-Ulrich Heise" <hei at adtranzsig.de> writes:
> > Isn't this a very real problem? I mean, i could
> > get around it using some export/import feature
> > that saves to a certain file format i define.
> > So i'd be writing save/load stuff myself again.
> > So what do i gain using ZODB or pickle or whatever?
>
> In ZODB versioning is handled by writing __getstate__/__setstate__
> methods for your class that will convert old instances to the new
> instance, by adding new attributes or whatever.  This means that if
> you change classes a lot, your __getstate__ will slowly accrete more
> complexity over time, but Jim Fulton argues that the burden isn't too
> great.

I agree with that. Checking some global version number should be enough
to reduce the runtime burden to (nearly) nothing when no version change is
required. And you'd need a similar functionality in any other save/load
mechanism as well if you want to provide backwards compatibility.
ZODB will surely become part of my next big software salad.

--
Dipl.Inform. Dirk-Ulrich Heise
hei at adtranzsig.de
dheise at debitel.net


"Andrew Kuchling" <akuchlin at mems-exchange.org> schrieb im Newsbeitrag
news:3dwviszl99.fsf at kronos.cnri.reston.va.us...
> "Dirk-Ulrich Heise" <hei at adtranzsig.de> writes:
> > Isn't this a very real problem? I mean, i could
> > get around it using some export/import feature
> > that saves to a certain file format i define.
> > So i'd be writing save/load stuff myself again.
> > So what do i gain using ZODB or pickle or whatever?
>
> In ZODB versioning is handled by writing __getstate__/__setstate__
> methods for your class that will convert old instances to the new
> instance, by adding new attributes or whatever.  This means that if
> you change classes a lot, your __getstate__ will slowly accrete more
> complexity over time, but Jim Fulton argues that the burden isn't too
> great.
>
> Some OODBs automatically convert objects to the latest version when
> the class is changed; this could probably be implemented on top of the
> ZODB somehow, though there's currently no way to get all the instances
> of a given class.
>
> --amk





More information about the Python-list mailing list