What is object marshalling?

30,506

Solution 1

Converting an object in memory into a format that can be written to disk, or sent over the wire, etc.

Wikipedia's description.

Solution 2

I beg to differ, Wikipedia is pretty clear on this.

In computer science, marshalling (similar to serialization) is the process of transforming the memory representation of an object to a data format suitable for storage or transmission. It is typically used when data must be moved between different parts of a computer program or from one program to another.

http://en.wikipedia.org/wiki/Marshalling_(computer_science)

Solution 3

People have defined marshalling quite clearly already, so I'll skip the definition and jump to an example.

Remote procedure call uses marshalling. When invoking remote functions you will have to marshall the arguments to some kind of standard format so it can be transport across the network.

Solution 4

Marshalling is the process of transforming the memory representation of an object to a data format that could be stored or transmitted. It's also called serialization (although it could be different in certain contexts). The memory representation of the object could be stored as binary or XML or any format suitable for storage and/or transmission in a way that allows you to unmarshal it and get the original object back.

For an example of usage, if you have some online game with a client and server components and you wanted to send the player object containing player stats and world coordinates from the client to the server (or the other way around), you could simply marshal it at the client, send it over the network, and unmarshal it at the other end and it would appear for the server as if the object was created on the server itself. Here's a ruby example:

srcplayer = Player.new
# marshal (store it as string)
str = Marshal.dump(srcplayer)
#unmarshal (get it back)
destplayer = Marshal.load(str)

Solution 5

I clarified a google search to "data marshalling" and the first hit was on some place called webopedia which is pretty good. The gist is that you transform data back and forth to a form for things like transmission over a network. The problem it solves is that you can't really transmit data over a network in a form that is usable by a program. You have to solve a number of issues including things like endianness of data, how you store complex data types like strings, etc.

Marshalling is not just to solve network transmission problems but other problems such as going from one architecture to another, maybe different languages especially those that might use things like virtual machines, and other "translation" problems.

Share:
30,506
frankish
Author by

frankish

Worked most of my career in Linux/UNIX environments with Perl, Java, Sybase. Worked as a Developer, QA Engineer and UNIX Systems Admininstrator I like to ask the good questions so all can benefit from the answers. Hard to beat the fastest guns in the west around here. ;-)

Updated on July 08, 2022

Comments

  • frankish
    frankish almost 2 years

    I have heard this concept used frequently, but I don't have a really good grasp of what it is.