6.2. Why Do We Need Messages?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:
Copyright © 2001 O'Reilly & Associates. All rights reserved. |
|