BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Object Modified and Assignments/Loading

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design
View previous topic :: View next topic  
Author Message
Lee_Nover
Guest





PostPosted: Fri Feb 04, 2005 6:42 am    Post subject: Object Modified and Assignments/Loading Reply with quote



I have a class with a property Modified: Boolean
this class implements ITransportable that has Assign/Load/Save
now I don't know what should be 'the proper way' to handle the Modified
property when assigning/loading
should it accept the source's property or always set it to true or false
now I copy the Modified value in Assign and always set it to False in the
Load method
(Load copies data from another kind of object - transport layer)

what about Save .. imho the best is to :
if Obj.Save(Data) then
Obj.Modified:=not RemoteSave(Data); // set the modified flag to false on
successfull update

I just don't have a clear view on this .. all ideas welcome Smile
tnx
Back to top
Joanna Carter (TeamB)
Guest





PostPosted: Fri Feb 04, 2005 8:39 am    Post subject: Re: Object Modified and Assignments/Loading Reply with quote



"Lee_Nover" <Lee_Nover[nospam]@delphi-si.com> a écrit dans le message de
news: [email]opslnt9eemignj8p (AT) istvangx270 (DOT) vasco.si[/email]...

Quote:
I have a class with a property Modified: Boolean
this class implements ITransportable that has Assign/Load/Save
now I don't know what should be 'the proper way' to handle the Modified
property when assigning/loading
should it accept the source's property or always set it to true or false
now I copy the Modified value in Assign and always set it to False in the

Assigning should change the Modified property because you are setting the
state of one object to be the same as another object; that is a change in
state.

Quote:
Load method
(Load copies data from another kind of object - transport layer)

If you are talking about loading initial values into an object, then you
should not alter the False state of the Modified flag as the object has not
been modified, simply loaded.

Quote:
what about Save .. imho the best is to :
if Obj.Save(Data) then
Obj.Modified:=not RemoteSave(Data); // set the modified flag to false
on
successfull update

This seems a good idea to me :-)

Joanna

--
Joanna Carter (TeamB)

Consultant Software Engineer
TeamBUG support for UK-BUG
TeamMM support for ModelMaker



Back to top
Lee_Nover
Guest





PostPosted: Fri Feb 04, 2005 10:29 am    Post subject: Re: Object Modified and Assignments/Loading Reply with quote



Quote:
should it accept the source's property or always set it to true or false
Assigning should change the Modified property because you are setting the
state of one object to be the same as another object; that is a changein
state.
I see your point and agree Smile


Quote:
Load method
(Load copies data from another kind of object - transport layer)

If you are talking about loading initial values into an object, then you
should not alter the False state of the Modified flag as the object has
not been modified, simply loaded.
ok

I've set up some constraints so this fits well
the loaded object is always assumed clean (not modified)

Quote:
what about Save .. imho the best is to :
[..]
This seems a good idea to me Smile

tnx :)

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.