4.3 Programming and abstraction
In the early 1990s programming an application for the internet was a tough proposition. I remember that I once had an application which required a very simple form of communication with another application located at a remote computer. I used a technology known as Winsocks which required me to carry out some pretty arcane code development just to send a simple test message to another computer and to receive a reply from that computer.
Java, when it appeared in 1996, enabled developers to treat another computer on a network essentially as if it was an input or output device; the programming code required to send data or receive data from another computer differed only slightly from that required to send and receive data from files.
However, even the programming facilities provided in the initial releases of the Java system are in opposition to a principle that both the developer and the user of a networked system should be unaware of the fact that they are accessing a networked system. This principle has been enshrined in a sales statement from Sun Systems, the original developer of the Java language, that the ‘network is the computer’. What this means is that the developer should be designing and programming in such a way that much of the detail of the internet is hidden away under a number of levels of abstraction.
This is best exemplified by the idea of distributed objects. Many of you reading this book will have used Java: you will have developed a number of classes which describe objects whose methods were executed in order to achieve some processing aim. The objects that you employed were all created and stored in the main memory of the computer which you were using to carry out the programming. I would hope that you found that the object-oriented paradigm was a useful one which allowed you to think of a system in an easily approachable way: as a collection of objects interacting with each other in order to implement some functionality.
Distributed objects are objects which are stored on computers in a network, and to which messages can be sent as if they were objects residing on the computer which is sending the messages. In this way a programmer develops software for a distributed system in the same way that they would for a single computer: by defining classes and by executing code containing objects defined by the classes, with the code sending messages to the objects; the actual details of how the transport of messages occurs would be hidden from the programmer. (This is not the full truth, somewhere someone still has to distribute the objects to the computers in which they are stored.)
Two distributed object technologies: RMI, which is a pure Java technology, and CORBA, which enables distributed objects programmed in different languages to interact with each other.
The theme of greater levels of abstraction does not stop there, however. A form of distributed programming known as tuple space development is as far from the physical details of the internet as you could possibly get. Here the underlying model is that of a large shared data space to which computers on a network can read and write data. In Java this is implemented using a specific technology known as JavaSpaces.