• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

COM terminology (components vs. objects vs. interfaces vs. servers vs. plug-ins vs. DLLs) - need to clarify

In COM, there seems to be a lot of ambiguous and differing terminology used:

COM components
COM objects
COM interfaces
COM servers
COM plug-ins
COM DLLs

blah blah blah...

For the purpose of some documentation being written to document a COM API we've written, we need to be consistent in our wording and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncomg/html/msdn_components.asp doesn't seem to help.

Can anyone clear this up as to what each of these mean and how the terms interrelate?

Thanks.
0
Xtreem
Asked:
Xtreem
  • 5
  • 5
  • 4
  • +1
4 Solutions
 
AlexFMCommented:
COM DLL - library which contains number of COM components.

COM component - COM class in COM library. C++ class exposing COM interface.

COM object - instance of COM component.

COM server - COM class. Used to distinguish between server and client code. Client creates instance of COM class (server) and calls it's methods.

COM interface - like abstract class, used in COM. Other COM classes implement interface. COM interface doesn't contain any implementation, only method prototypes. Class which implements it must provide it's own implementation. This is the difference between COM interfaces and C++ abstract classes: abstract class can contain implementation.

COM plug-ins. Some prigrams contain protocols for writing plug-ins: libraries which can run together with host program and extend host functionality. In many cases such protocol is COM-based, in such case plug-in library is called COM plug-in. There is no common protocol for writing plug-ins or COM plug-ins, such protocol is always defined by host application.
0
 
gerhardschoemanCommented:
very briefly,

COM object implements functionality
An object is the basic unit of COM—it's the thing that COM creates

COM interface exposes functionality of object
An interface is a set of methods and a contract for what those methods do

COM component
A component is the object and its interfaces

COM DLL
Is a collection of components

COM server
Is an object of which instances can be created by clients using COM technology

COM plug-in
not to sure

Hope this helps

regards;
0
 
AlexFMCommented:
Correction:
COM component - COM class in COM library. C++ class exposing COM interface.  <<

COM component can be written in any language, not only C++.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
XtreemAuthor Commented:
So what's the difference between a COM component and a COM interface?  They both seem to amount to the exact same thing.
0
 
gerhardschoemanCommented:
no, a component is the interface + the object

regards;
0
 
gerhardschoemanCommented:
also, an object can have many interfaces so a component is the whole. All interfaces + object = component

regards;
0
 
AlexFMCommented:
Interface is list of function prototypes.
COM component implements one ore more interfaces. For every function prototype from interface COM component has function with implementation.
0
 
gerhardschoemanCommented:
>>>COM component implements
No, the object has the implementation of the interface.

regards;
0
 
XtreemAuthor Commented:
This is becoming unclear again. I thought objects were the instantiation of components. And as interfaces seem to be interchangeable with components, this make objects also the instantiation of interfaces. In fact, I'm certain objects are the instantiation of interfaces as interfaces are just classes and in object-oriented programming, objects are instantiation of classes (e.g., C++!).

The implementation of the interface is not the object (as far as I understand), it's the class that realises the interface (i.e., the coclass in IDL).

So, from what AlexFM last said ("COM component implements one ore more interfaces"), I think you're basically saying (from a C++ point-of-view) the component is the combination of the (exposed) interface and the implementation of the pure virtual methods in the coclass.

But gerhardschoeman, I think an object is definitely the run-time instantiation of one of these components (e.g., from CoCreateInstance).
0
 
XtreemAuthor Commented:
Ok, yes, I know how to program a COM interface in C++/IDL. But it's still not clear what the difference is between a component and an interface. They seem to be interchangeable terms. If they are not, then what is the difference?
0
 
AlexFMCommented:
Sometimes it is difficult to understand terminilogy without writing some code. Anyway, I found article which possibly can help:
http://www.cs.umd.edu/~pugh/com/

See the following parts:
Interfaces
Attributes of Interfaces
0
 
gerhardschoemanCommented:
>>> between a component and an interface. They seem to be interchangeable terms
If anything I think that an object and a component is more or less interchangeable but there is a big difference between an interface and a component.
Here is an extract from MSDN:
"To clarify, in COM, an object is some piece of compiled code that provides some service to the rest of the system. To avoid confusion, it is probably best to refer to a COM object as a "component object" or simply a "component.""
and also
"An interface is just a related group of functions and is the binary standard through which clients and component objects communicate"


regards;
0
 
Dariusz DziaraProgrammerCommented:
Difference between COM object (componet) & COM interface:

You can think about COM interface as a sort of contract (as AlexFM mentioned), set of methods (including special methods like properties & events), just pure abstraction. You can think about interface the way you think about documentation.

You can think about COM object (component) as about some resource (data) which can be accessed through one or more interface (sort of point of view). COM object has its implementation (realization) of abstract interface(s).

I don't think there is very big difference between COM object and COM component but there is big difference between object & interface.

Interface is abstration, sort of agreement, object is real life which can be accessed through some interface implementation.

Object can be seen on many different ways through interfaces. For example it can be seen as stream if it implements IStream interface and in the same time it can be treated like some device through implementing IYourDevice interface.

0
 
XtreemAuthor Commented:
Ok, I think I've nailed this now. I've just e-mailed my colleague doing this documentation the following:

Basically, a COM interface is just the port (i.e., set of methods and properties) that allows interaction with a COM object.
[This also means that a COM object is not what I said it was (an instantiation of a COM component), it is the compiled code that provides service/data to the rest of the system; therefore a COM object is not akin to an OOP (e.g., C++) object]

Since a COM object can have more than one interface to it (so basically, a set of interfaces that allow interaction in different ways depending on the target audience), the combination of the COM object and (one or more) COM interfaces is the COM component, but only in its implemented form.  COM interfaces need to be implemented (realised) by a class (coclass).

This is all code.  At run-time, when all these COM components are instantiated, what you end up with is a load of instances of your COM components.

So, in essence, using "COM object" the way you've used it is correct, but I think it would be more correct to say "COM component" because you are then implying the fact that all our COM objects have COM interfaces (even though this should go without saying, but better to be explicitly correct than half correct).

Then, where you've referred to objects that are instances, either stipulate that these are not COM objects (by calling them "network objects"), or call them "instances" or "instances of [our] COM components".

As for COM interfaces, I would only use this where the context literally means COM interfaces.  E.g., if you are actually referring to the interfaces by name or talking about pointers to the interfaces, etc.
0
 
Dariusz DziaraProgrammerCommented:
Now I have came to conclusion that COM compoment term is used more or less to describe file (ie. DLL) implementing COM objects.
For example (MSDN) every COM component has class factory object (special COM object that creates instances of another COM object).

MSDN:

"Every COM component has a class factory. A class factory is a special kind of object that implements the IClassFactory interface. When a client wants to create an instance of a COM component, it requests a pointer to the component's class factory from the COM run-time environment. COM uses the CLSID passed to it by the client to search the registry and locate the dynamic link library (DLL) or executable in which the component and its class factory reside."
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 5
  • 5
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now