Wednesday, November 19, 2008

Component and names

a component

When you're building a COM object, you are very concerned about how the interface works. The user of the interface however, shouldn't be concerned about its implementation. Like the brakes on a car, the user cares only that the interface works, not about the details behind the interface.

This isolation of interface and implementation is crucial for COM. By isolating the interface from it's implementation, we can build components.

Components can be replaced and re-used. This both simplifies and multiplies the usefulness of the object.


What's in a name?

One important fact to recognize is that a named COM interface is unique. That is, a programmer is allowed to make an assumption in COM that

if he accesses an interface of a specific name, the member functions and parameters of that interface will be exactly the same in all COM

objects that implement the interface. So, following our example, the interfaces named "driving" and "radio" will have exactly the same member

function signature in any COM object that implements them. If you want to change the member functions of an interface in any way, you have

to create a new interface with a new name.

0 comments: