Re: Tips: What is the magic Serializable interface does in Java?
- From: Arne Vajhøj <arne@xxxxxxxxxx>
- Date: Tue, 25 Mar 2008 22:13:12 -0400
Lew wrote:
Lew wrote:Furthermore, serialization imposes an additional public interface on a class, one which circumvents the usual protections of accessibility (e.g., 'private'). This is a huge development and maintenance responsibility on a class, as is maintaining serializability between successive API versions. What a PITA that would be for a class that would never need it.
Arne Vajhøj wrote:Serializable does not have any methods, so there are no "private"
anything that becomes accessible.
That is neither true nor relevant.
Not true ? What public methods does Serializable have ? (I need to
update my Java Docs !)
Serialization of a class makes the private members of that class, whatever they may be, accessible through the serialization / deserialization mechanism itself.
I see your point.
I don't consider that "circumvents the usual protections of
accessibility" because it is not really a public/private issue.
Persisting object to disk via serialization is usually a bad idea
because of the risk of incompatible changes to the class. Public
or private does not matter.
XML serialization is better because worst the XML files can be
edited (manually or programmatic).
Arne
.
- Follow-Ups:
- Re: Tips: What is the magic Serializable interface does in Java?
- From: Mike Schilling
- Re: Tips: What is the magic Serializable interface does in Java?
- From: Lew
- Re: Tips: What is the magic Serializable interface does in Java?
- References:
- Tips: What is the magic Serializable interface does in Java?
- From: Venkat Sadasivam
- Re: Tips: What is the magic Serializable interface does in Java?
- From: Roedy Green
- Re: Tips: What is the magic Serializable interface does in Java?
- From: Lew
- Re: Tips: What is the magic Serializable interface does in Java?
- From: Arne Vajhøj
- Re: Tips: What is the magic Serializable interface does in Java?
- From: Lew
- Tips: What is the magic Serializable interface does in Java?
- Prev by Date: Re: Java Web Start Icons, please register your preference.
- Next by Date: Re: HotJava - precisely why won't it run?
- Previous by thread: Re: Tips: What is the magic Serializable interface does in Java?
- Next by thread: Re: Tips: What is the magic Serializable interface does in Java?
- Index(es):
Relevant Pages
|