Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between serialization and writing and reading data structures to a binary file?

Serialization is kind of like storing data objects to enable us to transfer them anywhere but how is different from just simply writing a object or data structure to a binary file ...???

like image 675
Sayan Paul Avatar asked Oct 16 '25 15:10

Sayan Paul


1 Answers

Serialization is another - more formal, if you will - way of saying that you are generating a representation of an object or data structure and storing it somewhere. The destination for storage could be: be file, a database, another location in memory etc.

The name serialization implies that the contents/state of the object or the data structure will will be represented sequentially (serially) which is how computer memory is fundamentally organized: as a series of bytes.

Serialization is an abstract concept/process and in the general sense does not imply a specific representation. You might have a binary representation (binary serialization) or a text representation (XML or JSON to name a few) and potentially others. Even binary serialization can be accomplished in many ways as far as how the information about the object or data structure is organized.

The opposite of serialization is deserialization which takes a serialized representation of an object or data structure and re-creates, or restores the state, of the object or data structure into a usable form.

like image 163
Mike Dinescu Avatar answered Oct 18 '25 08:10

Mike Dinescu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!