21

...and unmarshalling/deserializing? Wikipedia's explanation leaves me none-the-wiser! I'm a Java programmer, in case the terminology is used differently in different languages.

32

Semantics are important here:

Marshalling implies moving the data, it does not imply transforming the data from its native representation or storage. Java Objects can be Marshalled over the wire in their native representation.

Serializing implies transforming the data to some non-native intermediate representation. For example: transforming a Java Object to JSON or XML.

Of course, most systems that Marshal data, Serialize it to some non-native format before they transport it.

| improve this answer | |
13

This question has been asked before, but on StackOverflow. Here is the link.

Quotation of the answer given by Jeffrey Hantin:

Marshaling and serialization are loosely synonymous in the context of remote procedure call, but semantically different as a matter of intent.

In particular, marshaling is about getting parameters from here to there, while serialization is about copying structured data to or from a primitive form such as a byte stream. In this sense, serialization is one means to perform marshaling, usually implementing pass-by-value semantics.

It is also possible for an object to be marshaled by reference, in which case the data "on the wire" is simply location information for the original object. However, such an object may still be amenable to value serialization.

As @Bill mentions, there may be additional metadata such as code base location or even object implementation code.

| improve this answer | |
2

A Marshaller does whatever it needs to do, to cast a data structure to be transported from one place to another. When I talk about "Data Structure" it could be anything. From an object itself (state data => field values) to a memory reference to that object that will be handled the client side by a "Stub" and on the server side by a "Proxy". It means that a Marshaller could use "Serializers" to transform that data structure into a low level representation much easier to transport. The transformation path could have another components like Compressors, Compilers, Adaptors etc. For me a Serializer is part of the Marshaller.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.