Object standard COM and CORBA

zhaozj2021-02-08  273

Object standard COM and CORBA

Combination software is a sign of a new generation of software technology development. Its proposes very nature. In order to improve software productivity, non-grassroots development applications, design and developers should use reusable software components, assemble the new application software system. .

Chasing the source, the idea of ​​organizing synthesis software by software module assembly has been proposed in the 1970s, and the function is a component, the function is adapted to different application requirements, and the module package of the ADA language is a component, implementation. The internal details hood, the module is connected and assembled through the interface specification, and Package also provides a class mechanism that enables the module to pass the class parameters to adapt to different application requirements. However, the limitations of traditional software system structures, with process-centric function modules, the ability of its expansion and multiplexing is poor, and there is a lot of difficulty in applying to modules. Object-oriented technology in the 1980s, making combined software emit new vitality. Object-oriented software, with data-oriented, object classes have both module encapsulation and class, but also have inheritance characteristics

It greatly improves the expansion and reusability of classes. Objects have the advantages over the functional modules of traditional software:

(1) Easy to understand, with complete semantic characteristics;

(2) Easy to expand and modify, with high versatility and adaptability;

(3) Easy to construct assembly, have a standardized external interface.

Developing application components must follow standards to ensure interoperability of software components, only compliance with unified standards, different manufacturers, different periods, different programming styles, different programming languages, different operating systems, different platforms Software or software components can communicate and cooperate. To this end, OMG (ObjectManageGroup) provides an object standard CORBA that defines an interface of a networked object, making the object at the same time. The CORBA-based object request Agent ORB provides the new format of the middleware for client / server development.

What is amazed is that Microsoft, as an OMG member, but has another CORBA, which is a comb (ComponEtObjectModel), the component object model, and positions COM into an object-based software development model. Although COM is considered to be Microsoft drum noise Technology, but supporting COM has been increasing, most of which come from Microsoft, including VisualBasic and Visualc .

In the face of the lack of a uniform, what should developer should do this situation? Who is COM and CORBA more winning? This article introduces CORBA and COM, then analyzes the advantages and disadvantages of these two standards and their components, and believe that readers will be after reading this article.

Do your own judgment and gain yourself.

I. Public object request agency structure: CORBA standard

Global Network makes all equipment and software on the online a vast resource share of global sharing. The computer environment has also developed from centralized development to distributed environments, and the development of open systems enables users to transparently use different models manufactured by different manufacturers. The isomerical computing resources composed of different platforms, therefore, distributed processing and application integration naturally become a common request for people, then what is distributed processing and application integration? What is their functions and key technologies? Simply put, distributed processing and application integration refers to constructing a distributed system of information sharing on the basis of different vendors, different language information resources, and can be effective on the basis of heterogeneous, network, physical properties. The integration of application systems and distributed processing is performed. The key to distributed processing is to define manageable software components, ie "objects" in object-oriented technology. The key to the application integration is to provide a unified application interface for cross-platform, cross-machine, and cross-programming languages. OMG organizes the requirements of today's information industry, the CORBA standard, the common object requesting agency architecture, which is an interoperability and portability distributed object-oriented application standard. The structure of CORBA is shown below:

The core of CORBA is object request proxy ORB, which provides a transparent mechanism of object location, object activation, and object communication. The customer issues a request for the service, and the object provides a service, and the ORB sends the request to the object and returns the output value to the customer. ORB's service is transparent to the customer, the customer does not know where the object resides in the network, how is the object communicates, how to implement, how to execute, as long as he holds an object reference to an object, you can Object issues a service request.

CORBA allows users to request object requests in two different ways:

1) Static call:

After the object code is compiled by a given interface, it enters the client's program. Therefore, static calls must know the objects and their types when compiling.

2) Dynamic call:

The code of access object is generated at runtime through the dynamic call interface DII of the ORB.

Regardless of whether the customer is requested, the ORB task is to find the location of the object to be object, activate the object, and pass this request to the object. After the object executes the requested service, return the output value to the ORB and then return to the customer by ORB.

The important concept of CORBA is:

1. Object connection

CORBA is widely supported by the object, and the interface defined by the interface definition language can also be implemented in a single server system. The flexibility of ORB can be directly integrated and will not make new objects restrict them from certain principles.

The object connection provides a method of using the ORB service when the object connection provides different types of object implementations, including: object reference, method call, security control, object-implemented activation and waiting.

2. Interface Definition Language (IDL)

CORBA uses IDL to describe the object interface, IDL is a descriptive language, its syntax is similar to C .

The data type provided by IDL is: basic data type, constructor type, template type, and composite type, operating instructions. These types can be used to define the type and return type of the unit, and the operating instructions can be used to define the services provided by the object.

The IDL also provides a module configuration, which can include an interface, and the interface is the most important in the type of IDL. It can be used as an object reference type in addition to describing the CORBA object.

IDL provides interface inheritance, and derived interfaces can inherit the operations and types defined by their base type interfaces. The interface inheritance of IDL has its own specificity, and details will not be described here.

In summary, CORBA's IDL is a descriptive language that describes the basic principles of interfaces followed by object-oriented system development.

3. Dynamic call interface

After compiling the IDL to the actual code for object-oriented programming languages, the customer can call the operation of known objects. In some applications, the user does not understand the application interface compilation information, but also requires the operation of the object, and then dynamically call the interface to call the user's operation. For example, the graphical user interface should support user browsing interface public libraries to get the operation information supported by each object, and users can choose the required object operation from the browsing object according to their own needs, and the specific object operation call is actually It is done with a dynamic call interface.

4. Interface public library

The interface public library is in place for the interface description of the IDL, and the navigation of the object inheritance hierarchy can be achieved by means of an interface public library, and a description of all operations supported by the object can be provided. The most common function of the interface public library is to provide information for interface browsers to help apply developers to find potentially reusable software components. ORB can use the interface public library to check the operating parameter type of the runtime, but the basic function of the interface public library is to provide type information, send request information support for dynamic call interface.

Second, component object model: COM standard

COM is Microsoft's product-weighted product. When designing development COM, Microsoft positions COM to object-based programming model, intended to promote software interoperability, in fact it is based on OLE, COM The OLE's object requesting agent defines the interface between the OLE component objects and applications.

The important concepts involved in COM are:

1. COM interface

The COM application and the application and the system are interacting between information and interactions, and their interactions are implemented by a series of functions, which are called "interface" or "interface". The COM interface is a contractual contract between components and components, providing services or functionality at specific levels.

The COM interface provides the following convenience:

· No need to recompile, the object can add new features;

· Can transparently send RPC calls to other processes or objects on another machine;

• Corresponding and use COM objects such as C, C , Pascal, Ada, and SmallTalk are capable of creating and using programming languages ​​that support pointer and explicitly or implicitly modified by pointers.

COM defines a special interface iUnknown to implement some basic functions. All objects support this basic interface, which is queryInterface, which allows the user to dynamically determine whether the COM object supports a piece of interface when the user is run.

The interface definition language of the COM is Comidl (Interface Definition Language). It is a simple extension, DCE, a distributed computing environment, which is an OSF (Open Software Foundation) organized a set of independent platforms. The middleware service, which makes the distributed application coordinated operation.

Developers can use COMIDL to create an instructions for interface methods for COM objects.

2. Use GUID to identify objects and interfaces

Future distributed object systems may be large enough to have millions of interfaces, while the components of the software must be uniquely identified. In a large complex system, if only the names of the name of the human reading are used to identify the components, then it is almost 100% of the name conflict. In order to avoid this incident, solve the name conflict problem, COM uses the global unique identifier Guid (GLOBALLY IDENTIFIER), each GUID has 128-bit integers and can ensure that the identifier is in the world and the world of time. Uniqueness. The COM's GUID and OSFDCE's UUID (Universally Unique Idenfifier) ​​is completely equivalent.

3. Abandon inheritance and using cluster Microsoft believes in a loosely coupled, dispersed, gradually improved object system, inheritance is the root cause of a lot of trouble, but Microsoft also recognizes that if the programming staff can control the inheritance level, then implement it Inheritance is a very useful technology, and it will not bring too much trouble. However, Microsoft still believes that the contract between the object and the object is not in the level and has an unisforced, and when the father or subcomponent changes, the behavior of the components associated with it is a non-definitional behavior.

COM provides two mechanisms to replace the achievement of inheritance. The two code reuse mechanisms are called suppression / proxy and clusters. In the previous mechanism, an object (external object) only provides internal use as a service If you use it, you can make yourself (external object) a customer of other objects. The customer's customers must never see internal objects. This is to say that an internal object of an object is completely hidden for customers of the object. This is the embodiment of encapsulation.

In the clustering mechanism, a clustering object is actually a synthesis object, synthesized by an external object and an internal object, and the external object directly presents the internal object to a customer of the external object, when the internal object is like a part of the external object. Therefore, the clustering mechanism is a special suppression / proxy mechanism.

4. Local transparency and remote transparency

COM allows customers to transparently communicate with objects, customers don't know where the object is communicating with the object, and the customer access object is completely through the interface pointer, the pointer is of course in the process, and each time the call is called Lead with some of the code in the process. If the object is in the process, you can call the object directly. If the object is outside the process, then call the agent object provided first with the COM, generate a remote procedure call to call other procedures or other machines Object.

5. COM library

The core of COM is to specify the interface of the object and its customers. COM itself also contains some system-level code, so COM also has its own implementation, the COM library is a system component, providing a COM mechanism. Microsoft Corco's COMOBJ on the Windows platform. The DLL is the implementation of the COM library, the implementation of the COM library on the WindowsNT and Windows95 platforms is OLE32. DLLE.

Third, COM and CORBA comparison

The main difference between these two standards is how they implement the interface: COM specifies the interface that must be implemented, and the interaction between component objects must via these interfaces, all of which must be exported by the base reference IUNKNOWN; CORBA Do not specify the base class, each manufacturer can use itself

Willing to achieve your own class.

The CORBA standard has no provisions on the reference implementation. This is OMG to deliberately ignore the interests of various manufacturers, and there is no clear provision on the implementation of the details. This is both a major advantage and many limitations because of the implementation of the manufacturer. While flexibility, it also incurred a lot of trouble. Such as

Uniform management, ORB is not compatible, and lack of portable servers. In contrast, COM clearly specifies the implementation details, but this strict control can also lead to bad consequences: the solution is not an optimal program.

Another difference between COM and CORBA lies in achieving different processing of inheritance, achieving inheritance, is an inheritance of class-oriented techniques utilizing class levels. Interface inheritance refers to the ability to reuse object interfaces that can be rely on class levels, which reflects the concept of encapsulation in OO. Microsoft does not use it, it believes that it is inappropriate to implement the inheritance to the interaction of the object model, so COM only supports the interface inheritance without supporting implementation.

IBM claims that a true object-oriented system must support implementing inheritance, IBM implements inheritance in its SOM. SOM is the first successful product in the CORBA family. It is born in 1991, IBM thinks SOM is object-oriented, while COM is based on objects. About the two major criteria for COM and CORBA, there is a problem that cannot be ignored - the level of the product and the type of product. Corba has many products that support the interaction of across the network. Microsoft's OLE is a COM product, but it does not support the interaction of cross-platform objects.

In summary, Microsoft as an OMG member does not support CORBA standards and invisible COM standards, making COM a direct competitor of CORBA and its implemented component OpenDOC. Since other members of OMG did not use desktop software as strategic focus, with Microsoft has become the dominant position in the desktop software industry, CoM actually became industry standards for desktop markets. Digital has decided to transplant COM on the OpenVMS and OSF / 1 platform, and build a bridge between COM and CORBA. Microsoft develops the WindowsNT operating system to replace the status of the UNIX operating system in the server field, and given Microsoft's strength and its market share, this possibility is large. If in a few years, Microsoft's wishes become a reality, most server vendors are used as a server quality operating system with Windows, and the distributed COM has the protagonist in the field of distributed interoperability. For many applications and development environments, in order to balance the advantages of component development, COM may

It is a wise choice. Today, the software is more complex and dedicated, and the assembly development is an effective method of controlling the complexity of the software that does not damage the overall performance.

转载请注明原文地址:https://www.9cbs.com/read-2486.html

New Post(0)