Component Object Model

Source: Internet
Author: User

Component Object Model

Basic concepts of DLL and com --

During my learning process, I had a vague concept of DLL and COM. I sorted out relevant information online and posted it for your reference.

In general, a DLL is a disk file. dll,. DRV,. Fon,. sys, and many system files with. EXE extension can be DLL. It consists of global data, service functions, and resources. It is loaded into the virtual space of the process at runtime and becomes part of the calling process. If there is no conflict with other DLL, the file is usually mapped to the same address of the virtual space of the process. The DLL module contains various export functions to provide external services. A dll can have its own data segment but does not have its own stack. It uses the same stack mode as the application that calls it. a dll has only one instance in the memory; DLL implements code encapsulation. dll compilation is independent of the specific programming language and compiler.

As for the role, let's first talk about the consequences of no dll: large applications are composed of many modules that complete relatively independent functions, they work together to complete the entire software system. Some modules may have common functions and will still be used when constructing other software systems. When constructing a software system, if the source code of all modules is statically compiled into the entire application EXE file, some problems will occur: one drawback is that the size of the application is increased, it occupies more disk space and consumes a large amount of memory space during program running, resulting in a waste of system resources. Another drawback is that when writing large EXE programs, all source code must be adjusted during each modification and reconstruction, which increases the complexity of the compilation process and is not conducive to periodic unit tests.

With the benefits of DLL: a completely different and effective programming and running environment is provided on the Windows system platform, you can create independent program modules as smaller DLL (Dynamic linkable Library) files and compile and test them separately. During runtime, the system will load the EXE program to the memory space only when it does need to call these DLL modules. This method not only reduces the size of the EXE file and the need for memory space, but also enables these DLL modules to be used by multiple applications at the same time. Windows itself implements some major system functions in the form of DLL modules.

What are com and COM +?

Components Object Model (COM) is a way for software components to communicate with each other. It is a binary and network standard that allows any two components to communicate with each other, regardless of the computer on which they are running (as long as the computer is connected ), no matter what * Operating System the computer runs (as long as the * operating system supports COM), or the language in which the component is written. Com also provides location transparency: When you write components, other components are in-process DLL, local EXE, or components on other computers, it doesn't matter to you. (Of course there will be performance differences, but even if you change the location of other components, you do not have to rewrite anything. This is the key .)

Com is object-based ?? However, this object concept is not the same as the objects in C ++ or visual basic that you are familiar. (By the way, "object" and "component" are almost the same thing. Gui doctors are willing to say "components" when talking about the structure of the application, but are willing to say "objects" when talking about implementation ")

First, the COM object is well encapsulated. You cannot access the internal implementation details of the object. You cannot know what data structure the object uses. In fact, object encapsulation is so strict that COM objects are often depicted as boxes. Figure 1 depicts a fully encapsulated object. Note how the implementation details are hidden from you.

Component Services in Windows 2000 is a very important part of enterprise-level applications. It provides almost all required functions for web-based, distributed applications. Although the COM + service was originally designed to provide services for COM components, it would be good if the. NET component can also use the COM + service. Because COM + can provide many services for components, such as object buffering, resource sharing, role security mechanisms, and distributed transaction processing.

In summary, COM has the following advantages:

The programming technology difficulty and workload are reduced, the development cycle is shortened, and the development cost is reduced. Generally, programmers only need to select the appropriate components according to the functional requirements of the application, and do not have to do anything in detail. The component module allocates the technical difficulty and workload of programming on individual personnel and time.

Hierarchical programming can be implemented to promote the professional production of software. Professionals can develop software components with strong professionalism, which ensures that common programming applications can complete the necessary application development without reducing the performance of use. The component modules that the application staff cannot implement can be customized by professionals.

The rich component market is promoted to meet various application requirements to the maximum extent, and it is quite easy to customize specific software modules.

The software reuse rate is improved, which improves the software efficiency and extends the service life. The Component Programming System localized a large number of programming problems, making software updates and maintenance fast and easy, and greatly reducing software costs.

 

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.