views:

1951

answers:

9

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

+26  A: 

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)

Geoffrey Chetwood
A: 

It means turning any data into another data type to transfer to another system.

E.g., marshalling a struct into an XML document to send to the webservice, or marshalling a pointer to send to a different thread apartment.

gbjbaanb
A: 

In a very generic sense in programming it simply means taking data in one format and transforming it into a format that is acceptable by some other sub-system.

Josh
+9  A: 

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

Wikipedia's description.

Adrian
+1  A: 

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.

Stephen Pellicer
+2  A: 

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)
Firas Assaad
+1  A: 

Basically it's an expression for generically transforming an object (or similar) into another representation that (e.g.) can be sent over the wire or stored to disk (typically string or binary stream. The opposite, unmarshalling, describes the opposite direction of reading the marshalled representation and re-creating an object or whatever in-memory-structure existed earlier.

Another current everyday example is JSON

Olaf
+1  A: 

Marshalling is the process of transferring data across application boundaries or between different data formats. Marshalling is very common, for example writing data to disk or to a database is technically marshalling, however the term tends to be used to describe data conversion for "foreign" APIs or for interprocess communication.

For example, in .NET, communicating between managed and unmanaged code (such as accessing certain win32 APIs) will likely require marshalling in order to convert back and forth between managed C# objects and C/C++ style objects (structs, handles, output buffers, etc.) The help for the static Marshal class might be helpful.

Wedge
+3  A: 

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.

Alvin