Message (computer science)

From Free net encyclopedia

Some programming languages based on the Actor model or other distributed programming models define messaging as the (usually asynchronous) sending (usually by copy) of a data item to a communication endpoint (Actor, process, thread, socket, etc.). Such messaging is used in Web Services by SOAP. This concept is the higher level version of a datagram except that messages can be larger than a packet and can optionally be made reliable, durable, secure, and/or transacted.

Messages are also commonly used in the same sense as a means of interprocess communication; the other common technique being stream or pipes, in which data is sent as a sequence of elementary data items instead (the higher level version of a virtual circuit).

In the terminology of some object oriented languages, a message is the single means to pass control to an object. If the object 'responds' to the message, it has a method for that message.

The equivalent in conventional (procedural, imperative or problem oriented) programming languages to a message is a function call.

Note that message is a function call, not the function or the signature of the function (i.e. formal parameters plus name), and not the function instance resulting from the call, so to 'send the message' means to 'call the function'. See message for other meanings, e.g. in communications protocols.

Sending the same message to an object twice will usually result in the object to apply the method twice. Two messages are considered to be the same message, if the name and the arguments of the message are identical.

Objects can send messages to other objects from within their method bodies. In most languages that support object orientation however, the sender of a message can be code that doesn't belong to any specific object as well.

Some languages support the forwarding or delegation of method invocations from one object to another if the former has no method to handle the message, but 'knows' another object that may have one.