...and, this is a good argument for hiding the data in your objects' attributes, and only accessing that data through method calls. Encapsulation and data hiding. Chris McDonough wrote:
You either need to account for older-state objects in your code or you need to manually upgrade instances of your objects. There's no standard way to do the latter.
----- Original Message ----- From: "brian.r.brinegar.1" <brinegar@purdue.edu> To: <zope-dev@zope.org> Sent: Tuesday, January 22, 2002 5:37 PM Subject: [Zope-dev] Product upgrades
I have done work on a couple of products and one thing I've noticed is if you change what is done in the __init__ method of an object there isn't a good way to make the change so that it takes effect on old instances of the object. For example:
def init(self): self.data.append('cow')
becomes:
def init(self): self.data.append('cow') self.data.append('horse')
things created with the first constructor must be removed and recreated if 'horse' is to be added. Is there a way to go through and update old instances of a product to a newer version? Or should backwards compatibility be designed into the product?
Thanks, --Brian
-- Steve Alexander