On May 4, 2011, at 3:16 PM, Igor Stasenko wrote:

> On 4 May 2011 15:02, Panu Suominen <[email protected]> wrote:
>> Hi,
>> 
>> we have a problem where we must create audit trail of changes made to
>> business objects. Also things should run inside transaction. Our first
>> approach was to create so called command objects from every change but
>> these would be hard to maintain by hand. For example there would be
>> ChangePersonName, ChangeXXXName classes and these would have to be
>> hand created in name: -mehtods. More "clever" approach we come up with
>> is to copy original object and use proxy that records messages send to
>> it and sends them to the copy. Also this proxy creates new proxy when
>> copy returns values. These proxies record message sends to transaction
>> and when transaction is ready these recorded message from all of the
>> proxies are done to the actual objects instead of copies.


mariano got a really nice proxy model based on the stratified proxy of igor 
(which is in 1.3).

>> To create usable copies I found method that (shallow) copies the
>> actual object and its instance variables (Object>>copyTwoLevel). The
>> method is marked to be deprecated soon.
>> Why is that and is there some alternative way of doing this kind of copy?

why copy is not enough for you?
and you redefine postCopy to copy the instance variables?

>> Also if you know some way to trivially handle the audit trail problem
>> I would like to hear... :)
>> 
>> 
> 
> I think that this is too special kind of copy to be provided by
> default in kernel (so whoever stated that this will be deprecated,
> i agree with him ;).

:) I know that guy.


> What you can do is to copy down this method to the root class of your
> domain hierarchy..
> I.e.
> consider that all your domain objects having single root superclass ,
> like MyDomainObject
> 
> and then you're free to use this specific kind of copy for your
> classes, without relying on it in Object protocol.

+1

> 
>> --
>> Panu
>> 
> 
> -- 
> Best regards,
> Igor Stasenko AKA sig.
> 


Reply via email to