Chapter 8. Distributed Object-Oriented Programming in C

Chapter 8. Distributed Object-Oriented Programming in C++

"So a basic naively determined difference between the human situation and the android situation is that the human being comes equipped with an ego, whereas the robot does not."

Cary G deBessonet, Towards A Sentential 'Reality' for the Android

In this Chapter

  • Decomposition and Encapsulation of the Work

  • Accessing Objects in Other Address Spaces

  • The Anatomy of a Basic CORBA Consumer

  • The Anatomy of a CORBA Producer

  • The Basic Blueprint of a CORBA Application

  • A Closer Look at Object Adapters

  • Implementation and Interface Repositories

  • Simple Distributed Web Services Using CORBA

  • The Trading Service

  • The Client/Server Paradigm

  • Summary

Distributed objects are objects that are part of the same application but reside in different address spaces. The address spaces may be on the same computer or on different computers connected by a network or another form of communication. The objects involved in the application could have been designed originally to work together or they may have been designed by different departments, divisions, companies, or organizations at different times and for different purposes. A distributed object-oriented application can be anything from a one-time collaborative effort by a collection of unrelated objects to a multigenerational application whose objects are spread over the entire Internet. The location of the objects can be intermixed between intranets , extranets, and the Internet. In the most general description of distributed objects, the object may be implemented in different languages such as C++, Java, Eiffel, and Smalltalk. Distributed objects play a number of roles. In some situations an object or collection of objects is used as a server that can provide database, application, or communication services. In other situations objects play the part of clients . Distributed objects can be used in collaborative problem-solving models such as blackboards and multiagent systems. Besides collaborative problem-solving models, distributed objects can be used to implement parallel programming paradigms such as SPMD and MPMD. Objects within the same application don't need any special protocol to communicate. The communication is achieved through normal method invocation, parameter passing, and global variables . Since distributed objects reside in different address spaces, inter-process communication techniques are required and in many cases network programming is necessary.

Applications that require distribution can be necessary for several reasons:

  • Resources needed (e.g., databases, special processors, modems, printers, etc.) are located on different computers. Client objects interact with server objects in order to access these resources.

  • Objects developed at different times, by different parties, which reside in different locations need to interoperate in order to perform some necessary work or solve some problem.

  • Agents implemented as objects are highly specialized and each agent requires its own address space because it is started as a separate process.

  • Objects are used as the basic unit of modularity and the modules have been implemented as separate programs, each with its own address space.

  • Objects have been implemented in a SPMD or MPMD architecture in order to facilitate parallel programming, and the objects are located in different processes and on different computers.

In an object-oriented application, the work that a program does is divided between a number of objects. These objects are models of some real-world person, place, thing, or idea. The execution of an object-oriented program causes its objects to interact with each other according to the models they represent. In a distributed object-oriented application, some interacting objects will have been created by different programs possibly running on different computers. Recall from Chapter 3 that each executing program has one or more processes associated with it. Each process has its own resources. For instance, each process has its own memory, file handles, stack space, process id, and so on. Tasks executing in one process do not have direct access to the resources owned by another process. If the tasks executing in one process need information stored in the memory of another process, then the two processes must explicitly exchange the information either through files, pipes, shared memory, environment variables, or sockets. Objects that reside in different processes that need to interact must also explicitly exchange information in one of these ways. The challenges for the C++ developer that wants to do distributed object-oriented programming include:

  • Decomposition and encapsulation of the problem and solution into a set of objects, with the realization that some of the objects will belong to different processes and may be located on different computers.

  • Communication between objects residing in different processes (address spaces).

  • Synchronization of the interaction between the local and the remote objects.

  • Error and exception handling in the distributed environment.



Parallel and Distributed Programming Using C++
Parallel and Distributed Programming Using C++
ISBN: 0131013769
EAN: 2147483647
Year: 2002
Pages: 133

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net