COM Aggregation   «Prev  Next»
Lesson 1

Introduction to COM Aggregation

In the previous module, we discussed reusability in a general context with software components. We also examined how to reuse COM (Component Object Model) objects with containment/delegation. In this module, we will continue our exploration of COM's reusability mechanisms by studying aggregation.
Reusing COM objects via aggregation requires some additional coding in inner COM objects, but does not require the outer COM object to mirror interfaces implemented in the inner COM object. The inner COM object is fully aware that it is being reused and its interfaces are exposed directly to the client. The client is not aware of aggregated COM objects. The client thinks the outer COM object implements all accessible interfaces.
At the end of this module, you will be able to:
  1. Explain what aggregation does.
  2. Describe how interface navigation and reference counting work under aggregation.
  3. Understand the guidelines for inner and outer objects under aggregation

The following information is of historical importance when considering Microsoft Middleware Technologies.

COM Summary

A component is a reusable piece of software in binary form (as opposed to source code) that can be plugged into other components from other vendors with relatively little effort. Microsoft developed COM, a specification of how to build components that can be dynamically interchanged, a standard that 1) components and 2) clients follow to ensure that they can operate together. COM was very efficient, yet extremely flexible and provided mechanisms for creating and controlling objects from scripting languages such as VBScript.
COM made it possible for applications from one vendor to activate itself inside the user interface of another vendor's application. It facilitated communication between components in different address spaces and threading models, and it took the pain out of distributing objects across networks. COM is a binary standard, and as such, it is not limited to only one programming language.
COM components can be implemented in several different languages, including (but not limited to) C/C++, Visual Basic, Delphi and Java. COM conforms well to the object-oriented paradigm. In addition, COM enforces use of the two principles of reusable object-oriented design presented by the Gang of Four:
  1. Program to an interface, not to an implementation and
  2. Favor object composition over class inheritance.

Reuse Mechanism