Re: question about serialization



Tobi wrote:
I'm prepping for the SCJP, and am for the first time playing with
serialization. I was wondering for what cases would serialization be
used, as preferable to storing stuff in a database? I've never seen
it used any place that I have worked. Is it commonly used? Or is it
more common with apps that aren't web based?

Thanks.

Tobi

That depends. Database use can be roughly divided into two categories:

1) Providing structured, secured an (for most practical purposes) standardized access to structured data.
2) Serializing object values/states with the sole purpose of restoring them at a later point in time.

Use case 1) is where relational databases where invented for and can by no means be compared to object serialization in Java. In this situation the database is one of the core deliverables as well as the integration point where custom applications and generic analysis and reporting tools, backup tools etc. can be linked together.

Use case 2) is a heavily stylized way of (mis-) using a relational database as a storage medium for object states. Numerous ORM tools exist to help automate this.

To make matters worse people who do not know the difference tend to mix both use cases inside the same physical database.

Besides a lot of minuses and pluses use case 2) can be similar to object serialization.

Regards,

Silvio Bierman
.



Relevant Pages

  • Re: Why would I want to serialise something
    ... >I read a lot about serialising things to XML. ... Serialization is a very helpful mechanism. ... rows and columns and stored in a relational database. ...
    (microsoft.public.dotnet.general)
  • Re: ASP.Net Caching Questions
    ... A serialization option you might consider is binary ... database will perform comparably to using Cache. ... large amounts of static data into memory and do fast lookups on it. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Serialization... just beginning
    ... I am just becoming familiar with serialization, ... I need to be able to serialize to an XML document from an SQL Server ... updated in the database (either automatically somehow, if possible, or by ...
    (microsoft.public.sqlserver.xml)
  • Re: reader/writer design question for custom datatype
    ... Database, and so on. ... stretch to refer to a DB connection as some kinda stream (although not ... Serialization and databases don't mix well. ... XML file, but I don't have as much experience with those. ...
    (comp.lang.java.programmer)
  • Re: Should a class directly reference $_SESSION?
    ... just learning a little about object serialization, ... But it's generally not a good idea to store any large amount of data in the $_SESSION, a file or a database. ... do the same, and manipulate it also. ...
    (comp.lang.php)