Robert

83%
Flag icon
Item 78: Consider serialization proxies instead of serialized instances
Robert
Even better, completely separate objects from their serialization/serializers. That is, have a separate object(s) that know how to take the serialized form and create/output the object (deserializer) and the reverse (serializer). This keeps your object itself nice and clean, and also allows you to more cleanly have several serialized forms of an object (e.g. JSON and XML).
Brian
· Flag
Brian
i like that last point. rather than to/fromJson, to/fromXml, to/fromString (!) on the same class....does that make it harder to serialize/deserialize deeply nested objects though?
Effective Java: A Programming Language Guide (Java Series)
Rate this book
Clear rating
Open Preview