Colin Putney cputney@wiresong.ca writes:
On 2009-12-31, at 6:58 AM, David T. Lewis wrote:
- How does one Data Migration in Smalltalk? I just know it from Rails,
where one has migrations, but how's that done in the Persistence layers of some Smalltalk. E.g what happens if I add or remove instance variables?
I don't know enough about Rails to understand the question, but in general it is straightforward to add and remove instance variables in Smalltalk.
Hi Friedrich,
David didn't understand the question because data migration is generally a non-issue in Smalltalk. When you add or remove an instance variable, the instances of that class are automatically migrated for you. There's a class called ClassBuilder that handles this as part of creating the new class. It builds the new class, locates all the instances of the old class, creates equivalent instances of the new class, copies instance state to the new instances and updates all object reference to point to the new instances. Finally, the old instances are discarded and available for garbage collection.
Well that' why I asked because I found nothing about it in the videos I've seen. So either it it "trivial" or so difficult that nobody dared to do it ;-)
The one area where data migration does become an issue is when objects have been serialized and stored outside an image. Then reading them back into an image requires migration. There are various methods of doing this, and they tend to depend on the particular needs of your application. Of course, if you're using Gemstone, there's not much need to store objects outside an image. :-)
I'm not yet decided, but it seems Gemstone is the most elaborate in that area and it seems to be rock solid. I'm not that much a fan of things which have not shown (yet) that they can handle that kind of stuff. Just imagine, I´d decide to go on "own" way just to figure out. Well Friedrich, you did not get it right....
Regards Friedrich