The System Object Model (SOM) and
the Component Object Model (COM):
A comparison of technologies summarized
IBM Corporation
Object Technology Products Group
Austin, Texas
SOM
Object enabling technology consisting of an advanced object model and a
syntax-free OO runtime engine sufficient for implementing object-
oriented programming languages. SOM solves the problems of cross-
language access and fragile base classes allowing class libraries to be
distributed and subclassed in binary form.
COM
Ostensibly, a "language-neutral" binary interface specification but
primarily a set of rules that must be implemented in every application
implementing interoperable "Windows Objects".
Programming methodology
SOM:
Object-oriented
COM:
Object-based
Comments:
Based on widely accepted parlance (e.g. Wegner, OOPSLA 87), object
oriented programming presumes implementation inheritance, A correct
characterization of the methodology is important because it typifies the
programming paradigm that will be found in applications built using the
methodology. COM requires programmers to adopt an unfamiliar,
proprietary programming model by redefining prevalent terms and
techniques in object oriented programming. SOM, on the other hand, uses
a programming model familiar to programmers who use object-oriented
programming languages.
Relationship to languages
SOM:
Language-neutral. Objects may be written in C or C++. Smalltalk and
Cobol bindings areunder development by vendors. Direct-to-SOM C++
products (available from Metaware and IBM) map the ANSI C++ language
directly into SOM.
COM:
Language-neutral, function pointer table based. The user is responsible
for constructing the function table. Objects may be written in C or C++.
Writing objects in C is more involved because the function table must be
constructed manually instead of the C++ trick of using a virtual base
class. Interestingly, the C++ method of using a virtual base class for
building the function table may not work properly with all C++ compilers
- not all compilers lay out the vtable structure the same way that the
Microsoft compiler does.
Comments:
COM's object model does not map into any OOPL and cannot be used as an
OOP runtime engine by compilers. SOM can be used as a common binary
runtime engine for C++ compilers and other OOPLs.
Static Typing
SOM:
Objects statically typed via the class hierarchy. For static method
invocations, the compiler checks that a class is of the appropriate
type.
COM:
Individual interfaces are statically typed, not objects. A programmer
deals with an interface pointer and must verify support for an operation
at runtime.
Comments:
Static typing permits the language compiler to prevent type mismatch
errors from showing up at runtime. Lack of static typing introduces more
runtime failure modes. COM objects require runtime operations to
ascertain which interfaces are supported by an object.
Distributed object support
SOM:
Provided by the DSOM framework.
COM:
Will be provided in the Cairo release in 1995.
Compound Document Support
SOM:
Provided by OpenDoc.
COM:
Provided by OLE
Method Resolution Mechanisms
COM:
User responsibility, requires 2 steps:
- Use QueryInterface or instantiation to get Interface