File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Serialization" Watch "Serialization" New topic


Albin Joseph

Joined: Jan 22, 2005
Posts: 21
What are the disadvantages of Serializable interface. Is there any performance or any kind of issues associated with Serializable interface.

Java source code examples | Java coding community.
Bert Bates

Joined: Oct 14, 2002
Posts: 8898
sliding over to the intermediate forum...

Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
There is really no performance hit if you implement Serializable, but you should implement it with care. Not everything should be Serializable. Remember if you make something Serializable, then its entire object tree must also be Serializable. So it could turn into a lot of extra work for no good reason.

Also, you probably don't want to make everything Serializable because some objects should not be serialized. For examples, GUI objects (in general) should not need not need to be serialized. If they do, that may be an indication of bad design.

Bottom line is, just because you can implement Serializable for everything doesn't necessarily mean you should.

Jeff Storey
Software Developer
Avinash Ramana

Joined: Jul 31, 2006
Posts: 11

Excellent article.

I've actually been working a lot with serialization in conjunction with Quartz Scheduler. I'm basically putting a serialized class(x.y.Clazz) into the database (blob) and then when it gets pulled to execute the x.y.Clazz , the version has changed because I updated it while x.y.Clazz was persisted.

I solved it by other means. But I realized the solution would be to start using XML because it's easier to manage certain aspects like not knowing where our classes were going..

Check this out for future gotchas

J2EE programmer for JTG..
I agree. Here's the link:
subject: Serialization
It's not a secret anymore!