Re: java serialization alternative
Bob Lee <[email protected]> Sat, 29 Mar 2008 15:45:43 -0700
| Newsgroups | gmane.comp.windows.devel.java.advanced |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Mar 29, 2008 at 3:10 PM, Attila Szegedi <[email protected]> wrote: > Interesting statement - care to elaborate? I've found that evolving > the class design is easy with serialization but then, I've been mostly > adding fields and paid attention that the default value of the field > is okay for existing serialized object representations. On a single > object level, it is basically an object-to-(name-value-pair) codec. > What pitfalls specifically do you have in mind? Making compatible changes isn't hard. Identifying incompatible changes, for example if a programmer makes a change to a class but forgets to consider serialization, is very tricky. You simply can't verify compatibility statically with serialization. The only way to verify that two classes are compatible is to run them and test them. You can either keep serialized data around in a file or something, or you can use a trick like this: http://crazybob.org/2006/01/unit-testing-serialization-evolution_13.html. Either approach is a pain in the butt. If you use a tool like Thrift, you can check two definitions for compatibility statically, so for example, you could add a submit check to your source control system or test suite to detect incompatible changes. Bob =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com