Sponsored Link •
More on objects and networks, but this time I try to make my own opinions clear, if not coherent...
This particular thread has gotten far more interest than I had originally expected, and has gone off in some interesting directions. But, as Mike Petry points out, it is hard to see where I'm going with all this. I'm not sure that I knew (or know) myself, but after the last couple of rounds of betting, perhaps it is time to go all in and show my cards.
So, let's go back to the first assertion that I made, which is that the object model that you use is tied to the language in which that object model is presented. From this, a lot of you concluded that it was therefore a bad idea to try to pass objects from one place to another while doing distributed computing, because you certainly don't want to tie yourself to a single language. After all, we all know that different languages are good for different things (or, just as important, are preferred by different people). So to keep from being tied to a particular language, we had better confine ourselves to simply passing data from one process to another while doing distributed computing.
To paraphrase a former president, you could do this, but it would be
wrong (here is where I turn my cards face up). First of all, it means
that you need to have a language-independent mechanism for passing data
from one place to another. But there is no more a language-independent
way of expressing data than there is a language-independent way of
expressing objects. If I tell you that a data type is an
int, you don't know its size unless you know if it is an
int in Java, of C (well, even then you won't necessarily
know) or C++. But you do know that I'm not talking about COBOL; but if
you want to talk COBOL you need to know how to translate my
int into your
PIC 9(x) for some value of x.
Sure, I will admit that the number of data types that need to be translated from language to language is smaller than the number of object types that might need to be so translated. But in both cases you are going to be needing to translate from one language to another. The task is essentially the same, whether you are translating objects or data.
What it really comes down to, at base, is that doing distributed computing of any form requires that you begin with a base set of conventions that you require everyone to buy into to make the communication possible. One set of conventions has to do with the way you will translate the wire representation into a set of data types that can be understood by the two (or more) participants. An alternative convention would be to agree on a language that will be used on the network (as stated earlier by Bill Venners). And if that network language is both object-oriented and a language in which you can implement the client or the server, you get a bunch of nice properties in your system.
For example, if you are sending Java objects over the wire, you can insure that sets of invariants that should govern the data in those objects will be respected on the other side (or at least checked). You can, if necessary, download new code for new objects (the thing that makes Javatm RMI and the Jinitm networking system so powerful). This last ability lets you change the system over time in interesting ways, which can't be done if all you are doing is passing data. It even lets you change the way communication happens, since some of the objects that can be passed are the proxy objects that are used to do the communication.
Does this mean that I'm saying you shouldn't program in anything but the Java language? Hardly; I fully agree with those who claim that different languages are useful for different things. There is now a need, and always will be, for mechanisms to translate information expressed in one language into another language. My only claim here is that this shouldn't be confused with the need to transmit the information across the network. You are much better off doing this within an address space (or on a single machine in different address spaces) where you can control all of the mechanisms. Trying to do this on the network is the equivalent of saying that the phone system should translate any language into an intermediate form and then re-construct into the language of the receiver on the other end. A much better approach, I would claim, is to carry a single language on the wire, and then have a translator on the other end when needed.
|Jim Waldo is a Distinguished Engineer with Sun Microsystems, where he is the lead architect for Jini, a distributed programming system based on Java. Prior to Jini, Jim worked in JavaSoft and Sun Microsystems Laboratories, where he did research in the areas of object-oriented programming and systems, distributed computing, and user environments. Before joining Sun, Jim spent eight years at Apollo Computer and Hewlett Packard working in the areas of distributed object systems, user interfaces, class libraries, text and internationalization. While at HP, he led the design and development of the first Object Request Broker, and was instrumental in getting that technology incorporated into the first OMG CORBA specification.|