Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Message passing
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Overview== Message passing is a technique for invoking behavior (i.e., running a program) on a computer. In contrast to the traditional technique of calling a program by name, message passing uses an [[object model]] to distinguish the general function from the specific implementations. The invoking program sends a message and relies on the object to select and execute the appropriate code. The justifications for using an intermediate layer essentially falls into two categories: encapsulation and distribution. [[encapsulation (computer science)|Encapsulation]] is the idea that software objects should be able to invoke services on other objects without knowing or caring about how those services are implemented. Encapsulation can reduce the amount of coding logic and make systems more maintainable. E.g., rather than having IF-THEN statements that determine which subroutine or function to call, a developer can just send a message to the object and the object will select the appropriate code based on its type. One of the first examples of how this can be used was in the domain of computer graphics. There are various complexities involved in manipulating graphic objects. For example, simply using the right formula to compute the area of an enclosed shape will vary depending on if the shape is a triangle, rectangle, ellipse, or circle. In traditional computer programming, this would result in long IF-THEN statements testing what sort of object the shape was and calling the appropriate code. The object-oriented way to handle this is to define a class called <code>Shape</code> with subclasses such as <code>Rectangle</code> and <code>Ellipse</code> (which, in turn, have subclasses <code>Square</code> and <code>Circle</code>) and then to simply send a message to any <code>Shape</code> asking it to compute its area. Each <code>Shape</code> object will then invoke the subclass's method with the formula appropriate for that kind of object.<ref>{{cite book|last=Goldberg|first=Adele|title=Smalltalk-80 The Language|year=1989|publisher=Addison Wesley|isbn=0-201-13688-0|pages=5β16|author2=David Robson}}</ref> Distributed message passing provides developers with a layer of the architecture that provides common services to build systems made up of sub-systems that run on disparate computers in different locations and at different times. When a distributed object is sending a message, the messaging layer can take care of issues such as: * Finding the process using different operating systems and programming languages, at different locations from where the message originated. * Saving the message on a queue if the appropriate object to handle the message is not currently running and then invoking the message when the object is available. Also, storing the result if needed until the sending object is ready to receive it. * Controlling various transactional requirements for distributed transactions, e.g. [[Atomicity (database systems)|atomicity]], [[Consistency (database systems)|consistency]], [[Isolation (database systems)|isolation]], [[Durability (database systems)|durability]] ([[ACID]]) testing the data.<ref>{{cite book|last=Orfali|first=Robert|title=The Essential Client/Server Survival Guide|year=1996|publisher=Wiley Computer Publishing|location=New York|isbn=0-471-15325-7|pages=[https://archive.org/details/essentialclients00orfa/page/1 1β22]|url=https://archive.org/details/essentialclients00orfa/page/1}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)