Search This Blog

Thursday, December 23, 2010

what is Serialization and when to do it?

Student: What is Serialization?
TechPalle: Serialization is the process of converting an object into a stream. stream can be xml stream or it can be a byte stream.
Student: Why should i do Serialization?
TechPalle: Serialization is required many times in Real time programming.
Below are the examples of when to use Serialization.
Ex 1: In the 3-tier architecture let us say we have BAL,DAL and UI layer. Now assume these projects deployed in three different machines. now i want to get an object of some class from one tier to other tier or application in another computer. So if you want to send objects from one computer to another , you cannot transfer the object in its original form . But you need to convert the object into some form of stream and then send the stream to another computer. Now after receiving the stream then get the object back by DE-serializing the object back from the stream. This is the common situation where you have to do Serialization and De-Serialization. See complete example of Serialization and De serialization in the next article.

No comments: