[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2006-05-10
16
Medium Priority
?
284 Views
Last Modified: 2013-11-18
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
Comment
Question by:Xtreem
  • 5
  • 5
  • 4
  • +1
16 Comments
 
LVL 48

Assisted Solution

by:AlexFM
AlexFM earned 1200 total points
ID: 16647677
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
 
LVL 5

Assisted Solution

by:gerhardschoeman
gerhardschoeman earned 480 total points
ID: 16647700
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
 
LVL 48

Expert Comment

by:AlexFM
ID: 16647720
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Xtreem
ID: 16648380
So what's the difference between a COM component and a COM interface?  They both seem to amount to the exact same thing.
0
 
LVL 5

Expert Comment

by:gerhardschoeman
ID: 16648498
no, a component is the interface + the object

regards;
0
 
LVL 5

Expert Comment

by:gerhardschoeman
ID: 16648518
also, an object can have many interfaces so a component is the whole. All interfaces + object = component

regards;
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 16648579
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
 
LVL 5

Expert Comment

by:gerhardschoeman
ID: 16648590
>>>COM component implements
No, the object has the implementation of the interface.

regards;
0
 

Author Comment

by:Xtreem
ID: 16648771
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
 
LVL 48

Expert Comment

by:AlexFM
ID: 16648883
0
 

Author Comment

by:Xtreem
ID: 16648912
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
 
LVL 48

Accepted Solution

by:
AlexFM earned 1200 total points
ID: 16648989
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
 
LVL 5

Expert Comment

by:gerhardschoeman
ID: 16649024
>>> 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
 
LVL 8

Assisted Solution

by:mrblue
mrblue earned 320 total points
ID: 16649534
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
 

Author Comment

by:Xtreem
ID: 16649938
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
 
LVL 8

Expert Comment

by:mrblue
ID: 16650417
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question