Component Technology (COM)-compenant Object Model

Source: Internet
Author: User

1What isCom

ComYesMicrosoftComponent Object Model (Component Object Model.

ComIs a specification that describes how to create a component that can be dynamically updated alternately. It provides the standards that customers and components should follow to ensure interoperability. The importance of this standard for component architecture is the same as that for any other system with alternate updates. For example, if there is no national standard (GB), Then the parts and products produced by various manufacturers will not be interchangeable. Each manufacturer has its own responsibilities. If the bolts on the motor are broken, it is inconvenient to buy the bolts produced by the original manufacturer. The Hypertext format language we are familiar (HtmlIn fact, it is also a language that tends to be standardized. There is no standard and nothing can work together.

ComA standard is a set of documents that set standards for the component architecture. All components developed in this book will follow this standard.

So what isComWhat about components?

2 ComComponents

ComComponentWin 32Dynamic Connection Library (DLL) Or an executable file (EXE) Executable releaseCode. FollowComThe components written in the Specification can meet all requirements on the component architecture.

So,ComWhat are the advantages of components? What is it? This involves introduction by the author.Com.

3 Why?Com

Application as traditional softwareProgramAfter the release, if you want to omit some of the content, or feel that some parts of the application are not perfect, you want to get a better version, this dream can be realized only when software publishers recompile and release new versions. This is a typical release method of traditional software. However, this seriously hinders the efficiency of software users, so that users want to do something, but the software has no corresponding implementation part. This greatly reduced the scope of use of the software, and also made the merchants frequently engage in software upgrades. In fact, the development progress of the application is not accelerated at all.

However, sinceComAfter the problem arises, the above problems are basically solved.

WithComSoftware developers can modify the application after it is released or add new features to it, which greatly facilitates users, because the application can be customized to a higher degree, the application is more flexible and dynamic. As a result, this may happen: Every user is using the same software, but in fact each user's software is quite different. Software developers can develop programs in a step-by-step manner, instead of completely rewriting them every year or two, which greatly accelerates the development of applications.

ComIt is regarded as the trend of application development in the future. To this end, the author also wants to dedicate such a "golden key" with such benefits to readers as soon as possible.

4 ComHistory

Com The predecessor is Ole It is an object link and embedded Microsoft Version. Ole The first version ( DDE As the communication mode between customers and components. Ole 1 Not introduced Com . However DDE Very slow and inefficient. Ole The second version Com . However Ole Is the first one developed Com System, cannot be implemented well Com Function, which enables Ole It is relatively large and inconvenient to use. Today, Com In many aspects, it shows more and more powerful vitality.

5. Features of components

SpeakingComIn fact, it is not appropriate to use blocks to describe them. When we were a child, we always thought about all kinds of things, and then we used block blocks to block them together. We can also regard components as a block or a small unit, which becomes an independent part of the application.

A traditional application consists of discrete files, modules, or classes. These components are compiled and linked to form an application. To release a new version of the application, you need to re-compile these components, which is time-consuming and labor-intensive. With the concept of components, you can insert the improved new components into the application, and replace the original old components to give new vitality to the application.

In addition, we can also have the idea of putting many ready components together to form a component library, such as a class library. When creating an application, if you want to use different components, you only need to call out the required components from the newly created Component Library and insert them to the appropriate location, to obtain desired functions. Just like building blocks, you can take out the blocks you like from the box, discard the blocks you don't like, and use wisdom to build your own apartment.

For components, we already know the concept of "blocks". The advantage of using components is that they can be dynamically inserted or detached from applications, this brings great convenience to the application producer. However, implementation of these functions requires a certain degree of foundation. Generally, two conditions are required: first, the component must be dynamically linked; second, each component must hide (or encapsulate) its internal implementation details.

As we have discussed above, components can be dynamically called or released, that is, our ultimate goal is to allow users to dynamically use components during application running. To achieve this goal, you must be able to dynamically link components together. The so-called dynamic, that is, the components are not bundled with the application when the application is released, so we will not discuss them now.ComBut components are separated from the application surface. Only when the application is running can components and applications be organically combined.

Next, let's talk about encapsulation.

We know that applications and components are dynamically linked at work. When we replace a component with a new component, the component must be disconnected from the system and then connected to a new component. Obviously, the new component must be connected to the application in the same way as the original component. Otherwise, the application needs to be re-compiled because the application may not recognize the new component at all, I don't know where to start. In this case, we need "encapsulation ".''.

To make it clearer, let's first introduce some terms. First, let's talk about the customer. When a program or component uses other components, we call it a customer. The customer connects to other components through interfaces,

When a component is replaced by a new component or a component changes, if the interface between the connected customer and the component does not change, the original customer does not need to make any changes. Similarly, if the customer changes and the interface does not change, the component does not need to be changed. From this, we can see that as long as the interface remains unchanged, components and customers can move over like black boxes.

To make full use of the dynamic link function, components and customers should try not to change their interfaces, which means they must be encapsulated. Encapsulation is similar to making them into black boxes. The Implementation Details of components and customer content cannot be reflected in interfaces. The higher the degree of isolation between interfaces and internal implementation details, the smaller the impact on interfaces when components or customers change. It can be seen that when the interface does not change, modifications to the component will have almost no impact on other parts of the application.

This encapsulation requirement imposes additional limitations on components.

(1)Programming LanguageHide.

The customers who use components are not so excited that they know that the components they are using are actually used.CWrite or useJava. Any customer should be able to use any component, No matter what programming language they use. Components should not be specific to programming languages.

Many people in the world are implementing their own components in different programming languages. If an application can only useC ++Language Components, becauseC ++Languages are now quite popular. However, if another programming language becomes popular after a certain period of time, people will give up using it.C ++To use another programming language. As a result, the original application will not be able to use new components, and there are different methods for writing components. If an application can use components written in any programming language, its vitality can be imagined.

(2) The component must be released in binary format.

As1Point: To hide the programming language of a component, the component release form can only be the most common binary form known to the world, that is to say, components must be compiled and linked at the time of release and can be put into use immediately. This provides great convenience for component upgrades.

(3) Components cannot change their forms because of their locations.

This is mainly for networks. Components and applications that use them can run not only in the same process or in different processes, but also on different machines. The customer's access to and use of local components should be exactly the same as the customer's access to and use of Remote components. Otherwise, when a component in a remote component gets local, the customer must be re-compiled so that it can process the new component.

(4) Component version compatibility.

The new version of components should be backward compatible. The customer can use both components of the old version and components of the new version. For users, this is undoubtedly a great convenience, and the software can only develop in this direction to obtain tenacious vitality.

6 Component Library

In the previous section, we have discussed Com Is a specification that describes how to establish dynamically and alternately updated components. It provides standards that should be followed between customers and components to ensure interoperability. However, if only one set of specifications is provided, and some specific implementation methods are not provided, there is still no way to start. Therefore Com Provides a name Com Library ( Com Library ) API It provides useful component management services for all customers and components. Com The provided operations can make the management of components consistent, which greatly saves Com Time spent by programmers on components and customer implementations. In addition, DCOM , Com The Library provides code required to communicate with other components on the network, which not only saves the time spent by developers on network programming, in addition, they do not need to understand the details of network programming.

but we still need to recognize another point, com is not a computer language, com is a component writing specification implemented by a programming language. In addition, com neither DLL , com uses DLL to provide dynamic links to components

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.