Traditional operating
systems only dealt with application binaries and not
components. Hence, the benefits of good component-oriented
design have till now never gone beyond the
compilation step. In an object-centric world isnt
it still a puzzle why operating systems cant
recoganize objects? For a long time now, operating
systems have been dealing only with application
binaries a.k.a. EXEs. Objects in one process could
not communicate with objects in another process using
their own defined methods. The operating system
defined certain mechanisms of inter-process
communication like DDE, TCP/IP, Sockets, memory-mapped
I/O or named pipes etc. These objects needed to use
these OS defined mechanisms to communicate with each
other.
ActiveX/COM
- A Truly Distributed Object-Oriented Architecture
Components developed
using Microsofts COM provide a way by which two
objects in different object spaces or networks, could
talk together by calling each others methods.
This excellent technology forces the operating system
to see applications as objects.
COM forces the OS to
act as a central registry for objects. The OS takes
the responsibility of creating objects when they are
required, deleteing them when they are not, and
handling communications between them, be it in the
same or different processes or machines. One major
advantage of this mechanism is versioning. If the COM object ever
changes to a new version, the applications that use
that object need not be recompiled.
The wonderful thing
about COM components is that they are never linked to
any application. The only thing that an application
may know about a COM object is what functions it may
or may not support. In fact, the object model is so
flexible that applications can query the COM object
at run-time as to what functionality it provides.
Garbage
Collection is
one other major advantage to using COM. When there
are no outstanding references (a.k.a. pointers) to an
object, the COM object destroys itself.
COM supports Marshalling. Distributed Computing
purists will attest to the fact that marshalling is
the process of packaging and transmitting data
between different address spaces, automatically
resolving pointer problems, preserving the datas
original form and integrity. Even though COM objects
reside in separate processes or address spaces or
even different machines, the operating system takes
care of marshalling the call and calling objects
running in a different application (or address space)
on a different machine.
Over and above all
this, COM is a binary standard. A fully compliant COM object
can be written in any language that can produce
binary compatible code. So you can write em
using C, C++, Java, J++ or Visual Basic. All of the
Windows NT shell has been written using COM.