This is a perfectly valid question. If we have object-based communication schemes like CORBA and RMI available in the Java environment, why would we have to resort to passing messages, a simple but restrictive communication method, to transmit information between agents?
While message passing isn't as sophisticated and robust as distributed objects, it's relatively simple to implement using the java.io package. The goals of the two approaches are very different. Distributing objects extends an application across the network by making its objects appear to be spread across the hosts in our virtual machine. Message passing serves a much simpler role, defining a simple communication protocol for sending data. Passing messages over I/O streams also avoids the communication overhead involved in using most distributed object schemes, and doesn't require any special network protocols. So message passing is a useful and sometimes necessary tool, particularly in the following situations:
Communication needs are relatively simple in nature
Transaction throughput is critical
The scope of the your system is limited, so that rapid implementation takes precedence over sophistication and flexibility of design
Special network protocols need to be avoided (e.g., parts of the system need to operate behind a firewall)
Remote object protocols (e.g., an applet in a browser that doesn't support RMI or CORBA) simply aren't available
Copyright © 2001 O'Reilly & Associates. All rights reserved.