Component Object Model

An object-oriented programming mode
Collection
zero Useful+1
zero
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]
Chinese name
Component Object Model
Foreign name
Component Object Model
Interpretation
one kind object-oriented Programming mode of
Abbreviations
COM

Platform Introduction

Announce
edit
COM is a component software platform proposed by Microsoft since 1993 Interprocess 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 common Interface , 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 to Windows operating system above. However, only Windows uses COM most often, and some functions have been .NET Platform replacement.

Development history

Announce
edit
The Windows operating system provides three communication mechanisms between applications: the clipboard DDE And OLE 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 provides Compound 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 is Reference Count (Reference Counting)
These two functions are the root of COM: IUnknown interface Provided IUnknown:: QueryInterface (), IUnknown:: AddRef() and IUnknown:: Release () The origin of the three methods. be-all component All COM components must implement IUnknown, which means that each COM component has the same capability.
Components that are only derived from COM are called Pure COM component
But as Windows continues to grow, Visual Basic 4.0 Start Support OCX , 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 interface component Only supports C/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, called IDispatch Interface. All those that implement this interface can support cross language support.
Microsoft refers to the components that implement this interface as Automation Components.

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 capabilities Windows 2000 The main application server platform on the Microsoft platform was started. At present .NET Framework System is also provided EnterpriseServices Namespace To support COM+.
Distributed COM
Distributed COM can communicate on the network COM Component, according to RPC (Remote Procedure Call), which will component Is extended to the network, but because of network security and firewall The problem of device context OM cannot be widely popular.
.NET
.NET Framework It's a new generation Microsoft Windows application program Development platform