ODBMS live-class evolution (was: Database options)

Chris Muller chris at funkyobjects.org
Mon Apr 4 20:24:57 UTC 2005


> Can you give an example of the code required on the domain objects to
> handle this?

The simplest scenario is a new instance-variable.  Say a new instVar, 'items'
is added to ClassX but there are already many instances of ClassX in the
repository without that variable.

The old instances will materialize in the client-image with nil in the items
variable, so you would probably want to use lazy-initialization instead of
direct-initialization:

  items
    ^ items ifNil: [ items := OrderedCollection new ]

And if a commit happens subsequent to this, the object will be "upgraded" in
the repository to point to the matching class-definition upon the next commit.

Other scenarios would surely require other considerations..

 - Chris



More information about the Squeak-dev mailing list