Serialization : When being asked, what is SERIALIZATION, I get answers which are really annoying. The following are some samples :)
- "The process of writing the state of an object to a file!"
- "Saving the object's state to the file system!"
- "Writing the state of an object to a file using streams basically output streams!"
Only to a file? What about saving the object's state in a database? Will saving in database not involve 'Serialization'? The above answers are more ridiculous than they actually seem.
Big question, what is it? The following is a closer one to what actually it is :
"Object serialization is the process of saving an object's state to a sequence of bytes, as well as the process of rebuilding those bytes into a live object at some future time."
(- Extract from Sun's Technical Article)
So, where is this 'serialization' needed? The answer is simple when we write any information to the disc, we write as bytes or when we transfer information via wire to machines, we transfer as bytes. Hence, to save an object's state or to transfer an object's state via wire, we need to express the object's state as a sequence of bytes.
Also at the receiver's end we need to construct some meaningfull information out of those bytes, or when we re-read the bytes from the storage device. Hence the whole process of serialization.
We should not encourage the use of 'de-serialization', because the whole process of state to bytes and then bytes to state gives it a complete meaning, which is serialization.
Transaction: What do we mean by a TRANSACTION? comming soon...