Sean's Note: Inside COM - 讀後筆記

2011年12月14日 星期三

Inside COM - 讀後筆記


COM (Component Object Model)

Benefits:
1. Application Customization, each component can be replaced with a different component that better meets the needs of the user.
2. Component Libraries, choose components from a components library like Lego building blocks to form applications.
3. Distributed Components, the application has been divided into functional parts that can be located remotely.

Requirements:
1. dynamic linking
2. information hiding(Encapsulate), the more the interface is isolated from implementation details, the less likely the
   interface will change as a result of changing the client or the component.

 
COM doesn't compete with or replace DLLs. COM uses DLLs to provide components with the ability to dynamically link.

For COM, an interface is a specific memory structure containing an array of function pointers.

A class is not a component. You can implement a single COM component using several C++ classes or C structures.

The COM client doesn't know the interface supported by a component. To find out whether the component supports a
particular interface, the client asks the component for that interface at run time.

In QueryInterface, you can't use a case statement because the interface identifier is a structure and not a number.

IID is type defined as a 128-bit(16-byte) structure called a GUID(Globally Unique Identifier).
In COM, a GUID used to identified a components is called a class identifier(CLSID).

沒有留言:

張貼留言