- The distributed objects style represents a combination and adaptation of several simpler styles. This style is augmented with the client-server style to provide the notion of distributed objects with access to those objects from different processes executing on different computers. In this style, objects are instantiated on different hosts. The objects can be data structures or legacy systems. The interfaces are special, all the parameters and return values must be serializable so they can go over the network. The default mode of interaction between objects is synchronous procedure call.
Distributed Objects: CORBA
- It is a standard for implementing middleware that supports development of applications composed of distributed objects. The basic idea behind CORBA is that an application is broken up into objects which are effectively software components that expose one or more provided interfaces. These provided interfaces are specified in terms of a programming language and platform neutral notation called as the Interface Definition Language (IDL).
The above diagram shows the connection of objects across machine, languages and process boundaries
- A client program obtains a pointer to an object that can perform a service for it, here labeled as Object Instance. After obtaining this pointer it makes calls on the object instance through one of its interface methods. The IDL compilers can target specific platform and programming language combinations which simplifies the connection when language, process and machine boundaries are involved. When an IDL interface is run through an IDL compiler, two code artifacts are created, known as object stub and an object skeleton. An object skeleton is an object in the target programming platform that provides empty implementations for each method defined in the IDL interface. IDL types are translated into local programming language types. The developer is then responsible for implementing these methods in target programming language. These implementations make up the object instance, known as true object.
- The object stub is an object that provides implementations for each method in the IDL interface in the target programming language. These method implementations do not actually perform the services provided by the true objects.
- When a method on the stub is called, the calling parameters are encoded into block of binary data in a process called marshaling. The stub then sends this block of data across machines or process boundaries, using a network or interprocess communication mechanism, to the object skeleton. The software that facilitates this is known as object request broker (ORB). The skeleton receives the call data, makes the corresponding invocation on the object instance and then marshals the return value or exception for the return to the stub. The stub then returns the data to the caller, here the client program.
In this way, a client program can invoke a remote object without explicit knowledge that it is remote.