Recommendations for Externalizable, new type ExternalizedImmutable
Are there any technical reasons why the Externalizable interface isn't as powerful as Serializable? For instance, providing 3 public methods, default zero-arg constructor, readExternal, writeExternal is quite painful when trying to design objects that are immutable, serialized, and maximally efficient.
The other thing about Externalizable is the fact that I cannot tag any fields as final to strongly enforce the immutable contract.
So my question is this. Why can the serialize code for Serializable tagged objects deal with final (aka const) objects and be able to operate on private or protected methods such as readResolve yet Externalizable is not afforded the same flexibility? I think that native Java deserializing of externalized objects can skirt the access/const rules/contracts that Java stipulates, because Serializable can operate on immutable types - so why not give Externalizable objects that same power?
I guess the answer to that is it is too late to make a breaking change to the Externalizable contract. So I would like to propose a third alternative serializing type (suggest ExternalizedImmutable) with the interface of Externalizable and the wielding power of Serializable.
Yes I know I can use Serializable to get around Externalizable's problems but we have designed a massive OODB which saves immutable state changes. We have done tests that show that we can halve our backend persistent store if we implement serialized objects with the Externalizable interface.
Thanks for any responses,
Ryan

