Penguin
Blame: Serialisation
EditPageHistoryDiffInfoLikePages
Annotated edit history of Serialisation version 5, including all changes. View license author blame.
Rev Author # Line
3 AristotlePagaltzis 1 [Serialisation] refers to conversion of in memory data structures to an easily transmittable/storable format which can be deserialised to an exact copy of the original data structure. The name refers to the fact that while the in memory data structure is usually nested and allows direct access to any of its parts, often scattered over memory, the serialised form is laid out sequentially, lacking the tree of pointers necessary to easily refer to any part of the structure, but collected in a single stream of data that is easy to treat as a unit. Transforming one form into the other is a mostly straightfoward process, except when it isn't, such as when dealing with circular references.
1 PerryLorier 2
3 AristotlePagaltzis 3 If serialisation is mainly used to persist data across invocations of a program, it is also referred to as persistence.
1 PerryLorier 4
3 AristotlePagaltzis 5 Within the confines of a single ProgrammingLanguage, many good solutions are available:
1 PerryLorier 6
3 AristotlePagaltzis 7 [Perl]:
8 [Storable | http://search.cpan.org/dist/Storable/] and [FreezeThaw | http://search.cpan.org/dist/FreezeThaw/]
9 [PHP]:
10 [serialize() | http://php.net/serialize]
11 [Python]:
12 Pickle (3 different versions)
1 PerryLorier 13
3 AristotlePagaltzis 14 In contrast, solutions spanning multiple languages tend to be domain-specific.
1 PerryLorier 15
3 AristotlePagaltzis 16 One such domain is marshalling. This is a term used in the context of [RPC], where the parameters passed to a function and the value returned from it have to be serialised to be transmitted across a network connection. Special care has to be taken about arguments that are passed by reference. Some form of [IDL] is commonly used to describe how a remotely called function's arguments are to be marshalled. Some languages also use an [IDL] for general serialisation. There are a number of standardised binary [Seralisation] methods:
1 PerryLorier 17
3 AristotlePagaltzis 18 * [BER]/[DER], the [ASN.1] encodings. These generate fairly compact, portable seralisations.
19 * [IIOP], used in [CORBA]. This requires the [CORBA] [IDL] to de-/serialise.
20 * [SUNXDR] was invented at Sun for [SunRPC], which is used for things such as [NFS].
2 PerryLorier 21
3 AristotlePagaltzis 22 In recent times, it has become fashionable to use [XML] as a [Serialisation] format for [RPC], as seen in [SOAP], which is mostly pursued by [IBM] and MicrosoftCorporation, and in [XMLRPC]. This is a consequence of the challenge that language neutral [Serialisation] has always posed. [XML]'s verbosity is beneficial for debugging but a pig on bandwidth.
1 PerryLorier 23
3 AristotlePagaltzis 24 [YAML] is another text based serialisation format designed to be language agnostic and easily human-readable and -writable. Implementations are available for most "agile" languages. It has been designed with an eye on use for configuration files, but is not restricted to that purpose.
1 PerryLorier 25
5 LawrenceDoliveiro 26 Another such format is [JSON].
1 PerryLorier 27 ----
28 CategoryProgramming