Basic COM  «Prev  Next»
Lesson 2 The COM specification
Objective Define COM.

COM Specification

COM provides a specification and a set of services for supplying client-server functionality through method (function) calls. A COM method follows a set calling procedure and uses a specific return type. COM methods are grouped together by placing them into a COM interface. A COM interface contains a group of related functions. In COM, we use a straight line with a circle at the end to denote an interface:

COM interface
COM interface


A declaration of a coherent set of public features and obligations; a contract between providers and consumers of services.


An interface is a classifier for the externally visible properties, operations, and receptions of an implementation classifier, without specification of internal structure. An interface may constrain the way in which its operations are invoked and may impose pre- and post conditions on its operations. Each interface often specifies only a limited part of the behavior of an actual class. An interface should define a coherent set of capabilities, whereas an implementation class often combines several purposes. A class may support many interfaces, either disjoint or overlapping in their effect. An interface has no private aspect; all of its contents are public. Interfaces may have generalization relationships. A child interface includes all the contents of its ancestors but may add additional content. An interface is essentially equivalent to an abstract class with no attributes and no methods and only abstract operations. All the features in an interface have public visibility (otherwise, there would be no point to including them, as an interface has no “inside” that could use them).
An interface has no direct instances. An interface represents a contract to be fulfilled by instances of classifiers that realize the interface. An interface specifying the behavior made available by a classifier to other, unspecified classifiers is called a provided interface. An interface specifying behavior requested by a classifier from other, unspecified classifiers is called a required interface. A classifier that implements an interface need not have the exact same structure as the interface; it must simply deliver the same services to external requestors. For example, an attribute in an interface may be implemented by operations in the implementation or the names of operations in the implementation may be implementation- specific (but many modelers will expect the exact operation to be provided by the implementation).
An interface represents a declaration of services made available to or required from anonymous classifiers. The purpose of interfaces is to decouple direct knowledge of classifiers that must interact to implement behavior. Instances may call on instances of classifiers that implement required interfaces, without needing direct associations among the implementing classifiers.

Interface navigation

COM requires all interfaces to implement specific functionality that supports Interface navigation and Lifetime management/reference counting. This requirement is expressed by saying that every COM interface implements IUnknown. IUnknown is an interface specification (not an implementation) that defines functions to support finding other interfaces and lifetime management. We will examine IUnknown in later lessons.
COM is a specification. It means it is available in the form of documentation and can be printed and read. One can download and read the complete COM specification from the official website of Microsoft Available: (https://www. This specification also includes lot of system code implemented by Microsoft.