Sunday, April 29, 2007

Built-in Persistence/Transactions

We have long now been able to let the computer handle memory management in our programs via garbage collection. Why not let it also handle persistence and change management? I think these are things that should be built-in and it would be handled more easily by the virtual machine. There could be a low level API for hooking up different persistence strategies (relational, object, etc) and code would no longer have to be dirtied up with SQL or even worse HSQL. At the very least, change management of objects should be handled by the VM. How much easier would exception handling be if you could also rollback all the changes that had occurred and you could get back to the state you were in before the error? I think these should be the new primitives.

Gemstone is the realization of this on the server. It would be nice to make the code on the client as transparent as well. I know some might laugh at this idea, but I think it has merit. Just like garbage collection seemed strange at first, why not allow automatic persistent management as well?


Runar Jordahl said...

I think garbage collection is a function most people can agree upon. Simply stated, it simply collects the memory for those objects that are no longer referred to by other objects. When it comes to persistency, transaction handling and change management there are so many different patterns to use, that implementing this behaviour in the VM does not make sense.

Persistency handling is best expressed as frameworks (TOPLink, Glorp, GemStone/S) written in Smalltalk. Sure those frameworks need support in the VM, but the more code we can have in Smalltalk, the easier it will be to adopt the functionality to the various needs projects have. The strategy needed will differ a lot between the various frameworks, and it changes as new lessons are learned. Representing this behaviour in the VM is too inflexible.

Change management is probably something that is good to have at the VM level, as a Smalltalk implementation would perform slowly, and clutter the code too much. In fact such support is in the VM: Again, I think only the basics should be at the VM level. Rollback for example, should be at the Smalltalk framework level. In fact some persistency frameworks will do a copy of objects before write, and then rollback is not used at all.

Anonymous said...

wow gold cheap wow gold buy wow gold world of warcraft gold wow world of warcraft wow gold WoW Warrior WoW Hunter WoW Rogue WoW Paladin WoW Shaman WoW Priest WoW Mage WoW Druid WoW Warlock power leveling powerleveling wow power leveling wow powerleveling wow guides wow tips google排名 google左侧排名 google排名服务 百度推广 百度排名 网站推广 商业吧 机床 LED灯 电池 塑料 摄像机 移民 甲醇 染料 福州热线 体育博客 股票博客 游戏博客 魔兽博客 考试博客 汽车博客 房产博客 电脑博客 powerlin518 logo design website design web design 商标设计