Component Object Model (COM) is a set of component object interface standards based on Windows platform, which is composed of a set of construction specifications and component object library.General objects are composed of data members and methods acting on them, while component objects and general objects are similar but different.Component objects use interfaces instead of methods to describe themselves.An interface is defined as "a set of semantically related functions implemented on an object". Its essence is a set of function pointer tables. Each pointer must be initialized to point to a specific function body.There is no limit to the number of interfaces implemented by a component object.[1]
COM is a component software platform proposed by Microsoft since 1993Interprocess communication(Inter process communication, IPC) and as a platform for component software development.COM provides programming language independent methods to implement a software object, so it can run in other environments.COM requires that software components comply with a commonInterface, this interface is independent of the implementation, so it can hide the implementation properties and be used correctly by other objects without knowing their internal implementation.
COM is implemented on multiple platforms, not limited toWindows operating systemabove.However, only Windows uses COM most often, and some functions have been.NETPlatform replacement.
Development history
Announce
edit
The Windows operating system provides three communication mechanisms between applications: the clipboardDDEAndOLE。The original name of OLE is Object Linking and Embedding. OLE can be said to be an improved version of DDE. OLE version 1.0 providesCompound file(compound document) processing.However, it is too complicated. Brockschmidt, Kraig's "Inside OLE" mentioned that it takes six months of mental chaos to understand what OLE is.Therefore, after OLE 2.0, Microsoft proposed COM architecture.All OLE components inherit from COM. These technologies include OLE Document, OLE Controls, Drag and Drop, etc.
Component Type
Announce
edit
COM is designed based on the concept of component object mode. In the foundation, each component should support at least two functions:
Query which interfaces are in the component (User Interface)
Let components do self life management. The practice of this concept isReference Count(Reference Counting)
These two functions are the root of COM:IUnknown interfaceProvided IUnknown::QueryInterface(), IUnknown:: AddRef() and IUnknown::Release() The origin of the three methods.be-allcomponent All COM components must implement IUnknown, which means that each COM component has the same capability.
Components that are only derived from COM are calledPure COM component。
But as Windows continues to grow,Visual Basic4.0 Start SupportOCX, that is, OLE Custom Control, which makes Microsoft start to think about how to make COM components cross language support. Under such requirements, it is necessary to provide a consistent interface and a set of capabilities to call methods in the interfacecomponent Only supportsC/C++In order to achieve cross language capability, COM must support the function of calling internal methods externally, which creates the Invoke() method. In addition, for cross language support,COM should provide a simple way to access and identify components, which is why GetIDsOfNames() exists. Combine these methods to define the necessary interface, calledIDispatchInterface. All those that implement this interface can support cross language support.
Microsoft refers to the components that implement this interface asAutomationComponents.
Related technologies
Announce
edit
COM was the main software development platform under the Windows platform, and affected many other related software technologies.
COM+
COM+It is an enhanced version of Microsoft Transaction Server in Microsoft Windows 2000. In addition to providing basic component transaction support, it also provides loose coupled events, object pooling and other application server capabilitiesWindows 2000The main application server platform on the Microsoft platform was started. At present.NET FrameworkSystem is also providedEnterpriseServicesNamespaceTo support COM+.
Distributed COM
Distributed COM can communicate on the networkCOMComponent, according toRPC(Remote Procedure Call), which willcomponent Is extended to the network, but because of network security andfirewallThe problem ofdevice contextOM cannot be widely popular.