Externalizable or Serializable?
NickName:M Sach Ask DateTime:2011-08-28T21:36:42

Externalizable or Serializable?

After going through the article at http://geekexplains.blogspot.com/2008/06/diff-between-externalizable-and.html, i got to know Externalizable is better than Serializalable as it provides better control on code and also faster .So Externalizable should be preffered instead of Serializable provided class definition is not changed.But when i see in any project i find using Serializable interface only. can it be ignorance or Serializalable provides some other advantage which i am missing?

Copyright Notice:Content Author:「M Sach」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/7221303/externalizable-or-serializable

Answers
Nathan Hughes 2011-08-28T13:44:21

The advantage of Serializable is it's incredibly easy to implement, and resilient to change (in most cases all you have to do is update the serialversionUID). Externalizable requires the programmer to actually do work, and do more work every time the contents of the class change. As the article you link to points out implementing Externalizable is also error-prone. So from the point of view of utilizing limited programmer time, often Serializable is a better choice. \n\nThe good thing about how Serializable and Externalizable are designed is that you can defer the decision to implement Externalizable until it becomes evident there's a performance problem, and you can selectively implement it only for those classes where there's a problem.",


Bohemian 2011-08-28T13:45:28

Serializable is a marker interface that indicates that instances can be written to an output stream and read back. You don't have to write and code (you just have to ensure all fields are themselves Serializable).\n\nExternalizable is a Serializable that alos provides custom (de)serialization code.",


More about “Externalizable or Serializable?” related questions

Externalizable or Serializable?

After going through the article at http://geekexplains.blogspot.com/2008/06/diff-between-externalizable-and.html, i got to know Externalizable is better than Serializalable as it provides better

Show Detail

Ignite cache: Serializable vs Externalizable

Which is better among Serializable and Externalizable? I have experienced Externalizable is slower than Serializable. Can somebody help me with this?

Show Detail

Questions regarding Externalizable and Serializable

We can take use of readResolve and writeReplace methods to designate replacement objects for both Externalizable and Serializable instances... Just wanted to know couple of things: 1)Can readObj...

Show Detail

How to override Externalizable to Serializable?

Hi I have classes that extend some given interfaces which I can't change. And those interfaces implement Externalizable. But I want to serialize my objects using regular Java serialization. Basic...

Show Detail

What is the difference between Serializable and Externalizable in Java?

What is the difference between Serializable and Externalizable in Java?

Show Detail

What is the difference between Serializable and Externalizable in Java?

What is the difference between Serializable and Externalizable in Java?

Show Detail

What is the difference between Serializable and Externalizable in Java?

What is the difference between Serializable and Externalizable in Java?

Show Detail

What is the difference between Serializable and Externalizable in Java?

What is the difference between Serializable and Externalizable in Java?

Show Detail

Serializable and Externalizable. Difference of constructor invocation while deserialization

I have read following article: http://javapapers.com/core-java/externalizable-vs-serializable/ In object de-serialization (reconsturction) the public no-argument constructor is used to

Show Detail

If java Serializable disappears, will the same be done with Externalizable?

I know the title question sounds like asking someone to look in his crystal ball, but ... Recently learned that Oracle plans or considers to abandon the Serializable interface. The reasons may be...

Show Detail