Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Tips: What is the magic Serializable interface does in Java?

Reply
Thread Tools

Tips: What is the magic Serializable interface does in Java?

 
 
Lew
Guest
Posts: n/a
 
      03-26-2008
Mike Schilling wrote:
> Arne Vajh�j wrote:
>> 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).

>
> Also because it gives the programmer more control over what's
> persisted. You can design the bean properties of a serializeable
> class to contain precisely what you want. And if need be, you can
> completely re-implement the class while keeping the same set of
> properties.


These things are true of Serializable serialization as well.

--
Lew
 
Reply With Quote
 
 
 
 
Mike Schilling
Guest
Posts: n/a
 
      03-26-2008
Lew wrote:
> Mike Schilling wrote:
>> Arne Vajh?j wrote:
>>> 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).

>>
>> Also because it gives the programmer more control over what's
>> persisted. You can design the bean properties of a serializeable
>> class to contain precisely what you want. And if need be, you can
>> completely re-implement the class while keeping the same set of
>> properties.

>
> These things are true of Serializable serialization as well.


Much harder to accomplish there, though. The real problem is how
seductive it is to let all of the class's fields be serialized (with
perhaps a few obviously transient ones marked as such), and not
realize until you need to modify the class significantly just how
screwed you are.


 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      03-26-2008
Mike Schilling wrote:
> The real problem is how
> seductive it is to let all of the class's fields be serialized (with
> perhaps a few obviously transient ones marked as such), and not
> realize until you need to modify the class significantly just how
> screwed you are.


Yes! This is the danger of Serializable - it is a heavy responsibility. That
was my point in the first place.

--
Lew
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FindBugs complaining about non-serializable field although everythinglooks Serializable laredotornado@zipmail.com Java 8 01-15-2012 06:18 PM
Object implements Serializable, but includes field(s) that do NOT implement Serializable Jimmy Java 4 08-08-2007 12:22 PM
Serializable interface and Double-Linked List Bulkan@gmail.com Java 2 01-09-2006 07:35 AM
Sending object over network WITHOUT using serializable interface Steve Line Java 8 01-14-2004 12:08 AM



Advertisments