1. Background of Serialization & Deserialization process:
Before we start our discussion about the Serialization and Deserialization, We will discuss one small concept, which we have studied in our academics. We know that all the high level languages (Java, C++, C etc) translated to low level or machine level language (i.e. Binary Code of 0 or 1). The compiler comes into play which actually performs this translation.
Why this translation was required? Our Machines like Computer or Server or Client understands one and only one language which is binary language. So, if we would like to instruct our machine to perform any kind of operation(s), then we need to request him (machine) in binary language.We can thought of Serializations on the same line. It is more or less similar concept, where in we translate one form into another form.
Why this translation was required? Our Machines like Computer or Server or Client understands one and only one language which is binary language. So, if we would like to instruct our machine to perform any kind of operation(s), then we need to request him (machine) in binary language.We can thought of Serializations on the same line. It is more or less similar concept, where in we translate one form into another form.
2. Application of Serialization & Deserialization:
- Serialization & Derialization is extensively used in Client Server paradigm.
- e.g. Web Client to Web Service communication like Object to JSON/XML serialization.
- Serialization used in standalone systems.
- e.g. Save objects in memory to flat or text file.
- Load objects from flat file or text file.
3. Serialization & Deserialization in client server paradigm:
We will discuss serialization & deserialization process in context of client server paradigm. We will take an example of typical web applications. How web client can able to communicate with web servers ?
- Web client wants to send data to server.
- e.g. In chrome or IE browser when we enter any URL like www.google.com.
- Web client will send request to web server.
- Web client prepare the HTTP request.
- Web client will serialize request.
- Web Server receive the HTTP request like GET, POST, PUT or DELET etc.
- Web Server receive HTTP requests.
- Web Server deserialize the HTTP requests.
- Web server process the request.
- Web Server prepares the HTTP response & sends back to response to web client.
- Web server prepare HTTP response & serialize response.
- Web Client receives the response of Web server.
- Web client deserialize the response & render on browser.
Typical scenario, (Web Client, Mobile Client or Window Client) sends request over the internet to the Server (like G-Mail, Google Docs, Google Analytic Server).
4. Example of Serialization & Deserialization process:
- Web portal of university having Students, Teachers and Admin staff section.
- Suppose, admin wants to save or export data of meritorious students of a particular year.
- Admin needs to serialize the student data to flat or text or xml file.
- Admin will perform following steps:
- Translate the Objects to binary data.
- Save the binary data to a flat/text/ xml file.
- This process of saving the Objects to corresponding data store is called serialization.
Suppose, latter on admin wants to view saved data in web port, then admin needs to perform following operation i.e. opposite of Serialization process.
- Read the data from a file (text/xml file).
- Translate the binary data to corresponding objects.
The process of loading or populated objects from saved data is known as deserialization.
Serialization and Deserialization process is backbone of distributed computing systems, which enables the distributed components to communicate over the network.