Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The easiest thing for you to do is still to use serialization, IMO, but put more thought into the serialized form of the classes (which you really ought to do anyway). For instance:</p> <ol> <li>Explicitly define the SerialUID.</li> <li>Define your own serialized form where appropriate.</li> </ol> <p>The serialized form is part of the class' API and careful thought should be put into its design.</p> <p>I won't go into a lot of details, since pretty much everything I have said comes from Effective Java. I'll instead, refer you to it, specifically the chapters about Serialization. It warns you about all the problems you're running into, and provides proper solutions to the problem:</p> <p><a href="http://rads.stackoverflow.com/amzn/click/0321356683" rel="noreferrer">http://www.amazon.com/Effective-Java-2nd-Joshua-Bloch/dp/0321356683</a></p> <hr> <p>With that said, if you're still considering a non-serialization approach, here are a couple:</p> <p><strong>XML marshalling</strong></p> <p>As many has pointed out is an option, but I think you'll still run into the same problems with backward compatibility. However, with XML marshalling, you'll hopefully catch these right away, since some frameworks may do some checks for you during initialization.</p> <p><strong>Conversion to/from YAML</strong></p> <p>This is an idea I have been toying with, but I really liked the YAML format (at least as a custom toString() format). But really, the only difference for you is that you'd be marshalling to YAML instead of XML. The only benefit is that that YAML is slightly more human readable than XML. The same restrictions apply.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload