This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I was browsing the sample questions / answers to the Developer's exam on Sun site and I'm not sure I agree with one of the answers. In Question 3 (RMI vs sockets) one of the advantages they list is: "RMI allows both state and behavior to be passed over the network". But if I use serialization over socket connection - I'm sending an object over network. Object has both state and behaviour, so why are they listing it as the RMI advantage?! Hope somebody enlighten me, Thanks, Kathy
Kathy, When you serialize an object yourself (via sockets), you're only passing the object's fields, not it's methods. You build a new object on the receiving end, using the fields passed over the socket connection. The class has to be on the client side as well as the server. The object's "behavior", from the point of view of the client, exists and runs on the client. Furthermore, all the connections to other objects that existed in the context of the server need to be recreated on the client side. When you access an object via RMI, only the stub needs to be on the client side (it can, of course, be downloaded). The stub provides the interface to the object running on the server. The code implementing the object's behavior runs on the opposite (server) end of the connection, and the object continues to operate in its original context. The actual behavior is accessed remotely, which is not the case when you recreate the entire object on the client after serializing its state. Jerry