[jokosher-devel] File format loading



(discussion forwarded to mailing list, now we have a mailing list)

I said:
Currently we have a cool (and documented! nice one laszlo!) file
format. However, there's not a *lot* of provision in it for
versioning, and we're bound to add new stuff in future versions. I
propose we change the current loader and bundle it up in a
Jokosher01Loader.py file, implementing two functions (Save and Load).
The load code should then do:

load the first bit of the file to get the version number
if version == 0.1:
import Load from Jokosher01Load
elif version == 0.2:
import Load from Jokosher02Load
else:
fail_dialog("This project was created with a newer version of
Jokosher; upgrade.")
Load(project)

and that way when we release 0.2 it has the 0.2 loader code in it.
That way we can do different loading things if we change the format,
but (critically) each version of Jokosher knows how to load the
project file created by older versions.

Most of the work for this is already done thanks to the file format
documentation.

And then Laszlo Pandy <laszlok2 gmail com> wrote:
This looks like a good idea. We will definitely have to rework the
loading and saving for 0.2 because right now it is spread across
Project, Instrument, and Event.

I want to have backwards compatibility for as long as possible. This
would be done as you said by having different loading modules for
different versions. I thought of another idea that might be worth
implementing as well.

I remember when using Word that to ensure compatibility you have to
select the proper version from the save menu (97, 2000, XP, etc.). Most
programs do it this way to allow a file saved in 0.3 to work in 0.1.
However since we have XML, we can place all versions of a Jokosher
project in one file. Thus, when you save a project using 0.3, it will
save three top-level tags; one for each version.

The first idea you suggested would allow newer versions to open older
version. My idea would allow older versions to open newer versions. Of
course that assumes that there is a use case for this (older distros not
upgrading?), and that there are not too many complications with new
features (obviously some things would have to be removed for an older
version).

In any case, this will be a good discussion for 0.2 and as long as we
have 0.1 rejecting anything other than "0.1", this should be enough to
avoid version problems for the lifetime of version 0.1.

That should cover it nicely. The big flaw, of course, with saving
older versions is that when you release 0.3 it has a *different*
0.2Saver than 0.2 did (because the 0.2Saver in 0.3 has to know to not
save any new 0.3 stuff), which means constant code maintenance on
every previous X.XSaver module every time we do a new release. Since J
project dirs aren't shared around, I wonder if we just do what HTML
does; if you come across stuff in the XML project file that you don't
understand, then you ignore it. This does mean that editing a 0.3
project in 0.2 might screw it up, though...





sil
--
If cryptography is outlawed, only outlaws wifo4(F9%!98f3((hg$;'da"d;f+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]