Re: simple persistence without databases

From: Robert Klemme (bob.news_at_gmx.net)
Date: 03/09/05


Date: Wed, 9 Mar 2005 14:50:57 +0100


"slothbear" <farbot@gmail.com> schrieb im Newsbeitrag
news:1110311527.226614.104670@f14g2000cwb.googlegroups.com...
> I have a simple application that has been using standard serialization
> for the save format. I have a small user community; no one has
> complained about the save format breaking with each new version
> (because I change class structure). But ... it is kind of
> unprofessional and I would like to fix it.
>
> A "real" database looks like overkill. Some of the smaller options
> (M.A.O.S., db4o) look interesting, but they are still kind of
> heavy/complicated for my little program (which is currently 88K).
>
> My current plan is to save one big Map, which will contain an
> assortment of smaller Maps with simple types. That will get rid of the
> class structure dependency. Much of the data are already in Maps (of
> simple types), so the save/load code will not have to do much juggling
> of values.
>
> Does that sound like a reasonable plan, or has my searching/researching
> overlooked a more simple method?

Yes, I think so. Please take a look at XML bean serialization. That way
it's human readable (well, sort of) but more important so, you can load
old configs with new classes. And as long as you just add members, you
don't have to do anything to read the old config. I guess it becomes more
complicate if you rename fields etc.

http://java.sun.com/products/jfc/tsc/articles/persistence4/

http://java.sun.com/j2se/1.4.2/docs/api/java/beans/XMLEncoder.html
http://java.sun.com/j2se/1.4.2/docs/api/java/beans/XMLDecoder.html

Kind regards

    robert



Relevant Pages

  • Re: best place to procure a good walking map of London at LHR
    ... Just about every format you could imagine is available in any ... (one of those things sponsored by local businesses) ... in three maps each a double A5 spread. ... I see walking round Edinburgh with a map are using our local ...
    (rec.travel.europe)
  • Re: Image-modeling - HELP
    ... No other format allows for UV maps. ... I think Vue tries to do a conversion of whatever format Poser ...
    (comp.graphics.apps.lightwave)
  • Re: Do any GPS units let you upload your own maps?
    ... These maps are created from 10m DEM data to ... has two computers running 24 hours a day to create the ... Are you saying that simply creating your own data in the format to ... know Intel copyrighted the assembly language commands for their ...
    (sci.geo.satellite-nav)
  • simple persistence without databases
    ... for the save format. ... (because I change class structure). ... assortment of smaller Maps with simple types. ... Does that sound like a reasonable plan, ...
    (comp.lang.java.databases)
  • Re: simple persistence without databases
    ... >I have a simple application that has been using standard serialization ... > for the save format. ... Using databases does involve a learning curve. ... It is better to define an external storage format ...
    (comp.lang.java.databases)