|
Microsoft's DCOM and the OMG (Object Management Group)'s CORBA are the
two main object networking standards. Since CORBA has a history of
being cross-platform and open, it was chosen for use in GNOME.
An important part of the CORBA is a standard syntax for defining the
capabilities of an object. This is the OMG's Interface Definition
Language. To start to build a simple hypothetical object, we would
write the IDL that defines how the rest of the world can make use of
this object:
interface Q {
void frobate();
};
|
An "interface" is what the world is able to see about a particular
object, and roughly corresponds to a 'class' declaration in a C++
header file. A wide range of objects can be defined using OMG IDL
syntax. For example, here is the IDL currently used by the GNOME help
browser:
module help_browser {
interface simple_browser {
//show URL in same browser
void fetch_url(in string URL);
// make new browser and show URL
simple_browser show_url(in string URL);
};
};
|
This IDL shows some of the other commonly used features of CORBA
interfaces. Related object interfaces may be grouped into
"modules". Operations on objects can accept parameters and return
values, including other objects.
An important part of software design is data representation. The CORBA
data types allow representation of almost any data structure through a
wide selection of basic data types, and a variety of ways to combine
those basic data types into complex data structures.
Available CORBA data types:
Basic
- Numeric (integer, floating and fixed point, and enumerated).
- Characters and strings, including wide characters.
- Object references - handles to CORBA objects.
Complex
- Structures and unions, which parallel C/C++ structs and unions.
- Arrays - runtime fixed-length, possibly multi-dimensional stores of multiple data elements.
- Sequences - runtime variable-length stores of multiple data elements.
- "any" values store values of any data type, along with the type information necessary to make use of that data type.
- The upcoming CORBA 2.3 specification will add "object by value" capabilities, which will allow expressing much more complex data relationships such as graphs.
CORBA objects can take advantage of a wide range of
features. Interfaces can inherit operations from other interfaces, and
exceptions can be raised if errors occur. In addition, the interfaces
provided by the ORB and the CORBA services provide utility interfaces
for applications along with additional ``cool features''.
The ORB is the library used by an application to take care of the
low-level CORBA implementation details, such as talking the IIOP
protocol to objects over the network, and keeping track of object
implementations that the application wishes to expose via CORBA.
The CORBA services cover functionality areas such as object trading,
time synchronization, transactions, event channels, and security.
Providing a detailed tour of the ORB and CORBA services interfaces is
beyond the scope of this document, but the reader is encouraged to
take advantage of the OMG's web site for more information on these
interfaces.
The overall result of all the CORBA features is a standardized
mechanism of abstraction. In CORBA implementations, this allows
benefits of network transparency and programming language transparency
to be realized. Computing resources can be more effectively used, and
language-independent object reuse becomes practical. As an generalized
inter-program communications mechanism, the value of CORBA is
unparalleled.
|