Differences between version 3 and revision by previous author of Serialisation.
Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History
Newer page: | version 3 | Last edited on Sunday, November 21, 2004 10:27:49 am | by AristotlePagaltzis | Revert |
Older page: | version 2 | Last edited on Thursday, November 18, 2004 2:12:11 pm | by PerryLorier | Revert |
@@ -1,32 +1,27 @@
-Serialisation is the concept
of taking some
in memory data structure and converting it
to a form that can be
easily written to a file, socket or other stream where it
can be deserialised later into
the same
in memory data structure.
+[
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
.
-This
is normally fairly straight forward, however it has some rather nasty corner cases, like dealing with groups
of objects that form
a cycle
.
+If serialisation
is mainly used to persist data across invocations
of a program, it is also referred to as persistence
.
-Serialisation is sometimes also called persistance usually if
the same program is expecting to serialise the data on exit and deserialise it on startup again.
+Within
the confines of a single ProgrammingLanguage, many good solutions are available:
-[RPC
] is a special case of serialisation, where you specify which function to call and serialise it's arguments and get a serialisation of the return value back
. Special care has to be taken about arguments that are passed by reference
. Usually an [IDL
] of some type is used to specify which arguments are passed by reference
and what methods are supported by the
[RPC] server
.
[IDL
] is also used by some languages which do serialisation to specify how things are serialised
.
+[Perl
]:
+ [Storable | http://search
.cpan
.org/dist/Storable/
] and [FreezeThaw | http://search
.cpan.org/dist/FreezeThaw/]
+
[PHP
]:
+ [serialize() | http://php
.net/serialize]
+[Python]:
+ Pickle (3 different versions)
-Cross language serialisation has always been a problem. There are many (good) solutions that you can use based on support for your language
, what goals you have and where your allegences lie
.
+In contrast
, solutions spanning multiple languages tend to be domain-specific
.
-One common solution recently has been
[XML
] based serialisation
, there
are two common
[RPC
] methods have been
used which both
use their own
[XML
] based
serialisation:
-* [SOAP] -- A standard created mostly by [IBM] and [MicrosoftCorporation]
.
-*
[XMLRPC
]
+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:
-XML of course has
the property that it is very verbose
, making debugging easy
, and bandwidth consumption high
. In this class is also
the [XML
] serialisation of
[ASN
.1
], which is just a serialisation method and isn't directly
used for [RPC
].
+* [BER]/[DER],
the [ASN.1] encodings. These generate fairly compact
, portable seralisations.
+* [IIOP]
, used in [CORBA]
. This requires
the [CORBA
] [IDL] to de-/serialise
.
+* [SUNXDR] was invented at Sun for [SunRPC
], which is used for things such as
[NFS
].
-[YAML
] is another text based serialisation language designed to be language independant.
[YAML
] has implementations
for many languages
, and is easily human readable
.
+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
.
-There are several binary seralisation methods:
-*
[BER
]/[DER] (aka [ASN.1] encodings). These generate fairly compact, portable seralisations.
-
-* [IIOP] (from [CORBA]). This requires the corba [IDL] to serialise/deserialise.
-
-* [SUNXDR]. This was invented at Sun. This
is used for SunRPC (which in turn is used for things such as [NFS]).
-
-Programming languages often have their own
serialisation formats:
-* [Python]
-- Pickle
. (3 different versions).
-* [PHP] -- PHP
"serialize()
"
-* [Perl] -- Freeze/Thaw
+[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.
----
CategoryProgramming