G
Guest
Hi,
I'm writing a program which is, and will continue to be, constantly extended
with functionality that require information. Until now the source of this
information has been found and modified using notepad in a txt file that was
parsed into fields in objects. (This solution because this was the format
that an older fortran program was using and we needed to do it in this way in
a transition period). Now I would like be able to save from the program and
wish to switch to object serialization, but I'm concerned about backward
compatibility if my classes that are serialized on disk is constantly
extended.
If I extend a class with a field and try to desirialize this class from a
source which did not have the field, I guess I'll get an exception, Right?.
Are there any attributes that can provide some kind of default values for
fields or indicate that it is 'OK!' that the field wasn't found.
Must a class match exactly the fields.
Alternatively I would use xml and write my own serialization and
deserialization methods. Rather cumbersome but maybe necessary if I want this
degree of freedom.
Another way could be to keep the old framework and then parse information
from this old framework to the new one - like when you open a word 97
document in word 2003.
Please comment.
best regards Jesper, Denmark.
I'm writing a program which is, and will continue to be, constantly extended
with functionality that require information. Until now the source of this
information has been found and modified using notepad in a txt file that was
parsed into fields in objects. (This solution because this was the format
that an older fortran program was using and we needed to do it in this way in
a transition period). Now I would like be able to save from the program and
wish to switch to object serialization, but I'm concerned about backward
compatibility if my classes that are serialized on disk is constantly
extended.
If I extend a class with a field and try to desirialize this class from a
source which did not have the field, I guess I'll get an exception, Right?.
Are there any attributes that can provide some kind of default values for
fields or indicate that it is 'OK!' that the field wasn't found.
Must a class match exactly the fields.
Alternatively I would use xml and write my own serialization and
deserialization methods. Rather cumbersome but maybe necessary if I want this
degree of freedom.
Another way could be to keep the old framework and then parse information
from this old framework to the new one - like when you open a word 97
document in word 2003.
Please comment.
best regards Jesper, Denmark.