People familiar with object-oriented programming and network programming must be familiar with ActiveX, OLE, and COM/DCOM concepts, but the relationship between them is still vague to many. The difference between components and objects should be clarified first. A component is a reusable module that consists of a set of processing processes, data encapsulation, and user interfaces (Rules Object ). The component looks like an object, but does not conform to the academic Definition of the object. The main differences between them are: 1) components can be used in another application called a container (sometimes called a container or host) or as an independent process; 2) A component can be composed of one class, multiple classes, or a complete application. 3) the component is reused by the module, and the object is reused by the Code. Currently, popular Component models include COM (Component Objiect Module, Object Component model), DCOM (Distributed COM, Distributed Object Component model), and
Architecture, public Object Request proxy Architecture ). At this point, the topic COM related to this article has appeared, while the topic "CORBA" has nothing to do with this article and will not be introduced. Starting from the difference between components and objects, we want to make it clear that COM and CORBA are at the bottom of the entire architecture. If you still cannot understand this, let's continue to look at it, finally, you will naturally understand it after looking back. Now we will describe the relationship between ActiveX, OLE, and COM. First, let everyone have a general concept. From the perspective of time, OLE was first introduced, followed by COM and ActiveX. From the perspective of architecture, OLE and ActiveX are built on COM, so COM is the foundation. From the perspective of name, OLE and ActiveX are two trademark names, while COM is a pure technical term, this is also why we hear more about ActiveX and OLE. Since OLE was the first to appear, from OLE, since the Windows operating system became popular, "Clipboard" (Clipboard) first, the communication between different programs is solved (the clipboard is used as the data exchange center for copying and pasting), but the clipboard transmits "dead" data, application developers have to write and parse code in the Data format themselves, so Dynamic Data Exchange (Dynamic Data)
Exchange, DDE) communication protocols have emerged, allowing applications to automatically obtain the latest data from each other. However, solving the "Data Format" Conversion between each other is still a heavy burden on programmers. The birth of Object Linking and Embedded (OLE) raised the data exchange of the original application to "Object Exchange ", in this way, both the data and the application objects of each other can be obtained between programs, and the data content of each other can be directly used. In fact, OLE is Microsoft's composite document technology, its original version only targets compound documents, but in later versions of OLE2, it imports COM. It can be seen that COM was born based on the needs of OLE, so although COM is the foundation of OLE, OLE was generated before COM. The basic starting point of COM is to allow a software to provide services for another software through a common institution. COM was born according to the needs of OLE, but its first user is OLE2. Therefore, COM and composite documents have little relationship. In fact, later, COM was widely used as a technology that has nothing to do with composite documents. In this way, Microsoft began to "color finger" general platform technology. However, COM is not a product and requires a trademark name. At that time, Microsoft's market experts had chosen OLE as the trademark name, so the COM technology began to be labeled with OLE. Although most of these technologies have nothing to do with composite documents. Microsoft's practice leads to the misunderstanding that OLE only refers to compound documents? Or is it not just a single compound document? In fact, OLE is the trademark name of COM, not just a composite document. However, Microsoft may not be able to explain it clearly. It takes considerable effort and time. As a result, with the development of Internet, Microsoft changed its mind in the spring of 1996 and chose ActiveX as the new trademark name. ActiveX refers to a loosely defined and COM-based technology set, while OLE still only refers to composite documents. Of course, the core technology of ActiveX is COM. The biggest difference between ActiveX and OLE is that OLE is aimed at the integration between application software and files on the desktop, while ActiveX focuses on providing further network applications and user interaction. Here, we should have a clear understanding of the relationship between ActiveX, OLE, and COM. COM is the most fundamental core technology, so the following focuses on COM. It is a novel idea to make the object model completely independent from the programming language. We can understand this in terms of the concepts of C ++ and Java objects. But what is the so-called COM object? For ease of understanding, we can regard COM as a certain (software) packaging technology, that is, regard it as a different part of the software, according to a certain object-oriented form, combine them into processes that can interact with each other and use groups to support databases. COM objects can be written in any language, such as C ++, Java, and VB, and can be implemented using DLL or as an execution file for different process work. When using a COM Object Browser, you do not need to worry about the language in which the object is written, or whether it is executed in a DLL or another process. From the browser side, there is no difference. Such a general processing technique is very useful. For example, the two applications run in coordination by the user can use their common job parts as the interaction between COM objects (of course, the current OLE composite document can also do ). To execute the code downloaded from the Web server in the browser, the browser can regard it as a COM object, that is, COM technology is also a standard method for packaging downloadable code (ActiveX controls execute this function ). You can even use COM to specify how an application interacts with a local OS, for example, in Windows or Windows
NT uses new APIs, most of which are defined as COM objects. It can be seen that although COM originated from the composite document, it can be effectively applied to many software problems. After all, it is a basic technology at the underlying layer. In a word, COM is a language-independent component architecture that allows components to communicate with each other. With the development of computer networks, COM has been further developed into a Distributed Component Object Model. This is DCOM, which is similar to ORB of CORBA. This article will not elaborate on this. I believe that you will have a clear understanding of the relationship between ActiveX, OLE, and COM/DCOM.