|
|
|
|
COM and ActiveX notation in UML and some basic principles COM stands for Microsoft Component Object model. This model is a proprietary way of designing components and the way these components communicate. This is a competing standard to CORBA from OMG. The basic building block for this model is the COM object. A COM object is an object that follows certain rules. All COM objects must implement an interface called IUnknown. An ActiveX object is a COM object that has implemented the IUnknown interface, and knows how to register1 itself.
Figure 1Circle: Symbol accociated with an Interface The symbol for an interface is a circle. In UML, this is a stereotype of a class.
Figure 2UML's notation of IUnknown displayed as a class All interfaces in COM inherits from IUnknown. IUnknown has three methods:
Figure 3Lollypop: The notation of an Interface that is implemented by an object The symbol for an interface that is implemented by an object is a lollypop. The line between the circle and the object itself is, in UML, an association of type refinement2.
Figure 4Microsofts notation for a COM/ActiveX object. A rectangle with rounded corners with the attached lollypop on the top is in Microsoft notation a COM object or ActiveX object.
Figure 5UMLs notation for a COM/ActiveX object. A folder, or package, is the symbol of a group of something in UML. If an interface is associated with it, using the refinement association, it describes a package of classes that exposes an interface. This can be interpreted as an COM or ActiveX object.
Figure 6 Microsofts notation for aggregation. Aggregation, the COM meaning of the word, means to expose another objects interfaces out of your object. The inner object uses the IUnknown implemented by the outer object for the IUnknown methods, hence reference counting and QueryInterface on the interface implemented by the inner object is done by IUnknown on the outer object, "Outer Unknown". The outer object is responsible for creating the inner object, and it is responsible for releasing the inner object when its lifetime is over. It uses the IUnknown implemented by the inner object, "Inner Unknown", for this purpose.
Figure 7UMLs notation for exposing another objects interface. The term aggregation has a somewhat different meaning in UML. However, it can be displayed in a similar way
Figure 8UML's notation for exposing an interface. All this can be simplified, by only showing the outer object, and displaying the interfaces exposed by it. For all objects using this object, it is of no concern whether the outer object implements the interfaces, or if it is some aggregation is used in order to achieve additional functionality.
1 Registration is a subject that will not be discussed in this document. Look at the reference for regsvr32.exe in the Microsoft documentation for further information. 2 For further reference on refinement, look at the latest UML documentation, or ask Grady Booch.
|
|