| View previous topic :: View next topic |
| Author |
Message |
Lee_Nover Guest
|
Posted: Fri Feb 04, 2005 6:42 am Post subject: Object Modified and Assignments/Loading |
|
|
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
tnx
|
|
| Back to top |
|
 |
Joanna Carter (TeamB) Guest
|
Posted: Fri Feb 04, 2005 8:39 am Post subject: Re: Object Modified and Assignments/Loading |
|
|
"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
|
Posted: Fri Feb 04, 2005 10:29 am Post subject: Re: Object Modified and Assignments/Loading |
|
|
| 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  |
| 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
|
tnx :)
|
|
| Back to top |
|
 |
|