What does Serialization mean in Programming terms? – A Simple Explanation!
Simple Explanation by Analogy:
Suppose I’m talking to my buddy in NYC (and i’m on the other side of the world) and I’m telling him about the new puppy that I’ve got.
“Dude, what is a puppy?” was the response.
He doesn’t know what a puppy is? Here’s my problem: the puppy is a living, breathing mammal. How am I meant to convey the what a puppy is to my buddy over the phone line? I can’t physically put my puppy into my receiver and have the puppy come out on the other side of the world through my telephone line.
I’d have to convey a representation of the puppy over the phone. In other words, I then serialize my dog Rex, and I send him the serialized version of Rex over the phone line:
{ "name":"Rex", "age":5, "favourite_food": pedigree_choice_cuts, "favourite_game": fetch_ball, "favourite_hobby": wagging_tail }
It’s a perfect representation - a serialization of my dog.
Summary
Serialization basically means transforming my dog Rex into something else - a JSON object - which can then be transported over the phone line as a series of 1s and 0s. My buddy in in NYC can then translate those 1s and 0s back into a JSON object - so that he has a perfect representation of my dog Rex.