Platform plug-in software design ideas and COM-based prototyping Goldboar
Introduction: We have become accustomed to being independently carrying out software development. Everyone uses their own style for programming, but as the project has become bigger or the time requirements are tight, they need a few people, more than a dozen people, and even even It is a hundred people collaborative for software development and design. At this time, a more tricky problem is how to seamlessly integrate the software code (possibly link library, component) written, although the source code integration is compared. Traditional is also more mature, using link libraries or components, can also reduce the leakage of source code, but often is that every program integration and code maintenance need to recompile and link source code and re-release new software. Sometimes it is very troublesome. Then there are questions, can have a way to divide the target software that will require development into several functional components, and the parties follow the standard interface regulations, so after the various components are developed as required, only the entire software integration is only The required components are assembled instead of integrated source or link libraries to compile and link. It is also developed according to the regulations when needed. After the assembly software can be used, this is the use of a binary software integrated method. . The answer is affirmative, this is the software design method of platform plug-ins. First, existing software systems (platform plug-ins) introduction to plug-in category now take a look at the root of all software systems - Operating Systems (OS). The operating system is a system software. It is a key software that is indispensable to computer. Only the computer that has an operating system can be used for people to change to a true computing tool. In addition to completing its basic function, the operating system also provides software developers with application development interface (API), software developers use API to write software design and code writing, after program debug compilation, installed after the relying operating system, Software developed by users (can be divided into tool software and application software) can run normally. At this time, it is not necessary to modify the operating system, nor does it need to recompile and link the operating system. For user software, the operating system is completely transparent. The operating system and user software are an excellent platform plug-in instance. In addition to the operating system, there are many software system instances of this platform plug-in in terms of user software, where the famous name is the Photoshop graphics processing software of Adobe. Photoshop except for its exceptional functionality, there is also an impression of developers that its plugin (PLUG-IN) feature. In order to improve the processing function of the graph, Photoshop provides a standard plug-in development interface. Such a third-party software developer can develop unique graphic feature extensions by standard plug-in interface. After the development of the plugin installed, the system can be used without affecting the main Programs and other plugins extend through this method Photoshop extends thousands of Filter function plugins. In addition to Photoshop, the software that uses plug-in technology has the series of software, and the series of Microsoft's Visual Studio development tools and Office office software, and Office. Plug-in technology applied by each user software can be divided into three types: 1. Simple plug-in (text plug-in) similar to a batch command. In fact, the degree of freedom in this plug-in is very low. With this method, the software is Win Hacker et al. Once running this plug-in, it will be required to perform the selection / input according to the user's input, and finally perform a series of prior defined operations according to the user's input. This plugin is generally a text file. The function is relatively single, the scalable is extremely small. The advantage is that the plug-in is very convenient, even if there is not much to understand the programming, it can be produced.
Skin, like Winamp. 2. Use a special scripting language to implement the plugin (script plugin). This plug-in is more difficult to write, requiring software developers to make a program to interpret the kernel. For example, Microsoft makes a lot of troublesome macros are this type. Microsoft Office provides a built-in VBScript (VBA) for developers to extend the auxiliary function. The advantage of this method is that there is no need to use other tools to make a plugin, the software itself can be implemented, and there is generally in various office automation software. 3. Use the existing program development environment to make a plugin (program plugin). Methods such as photoshop and other software use. Software using this method has established a plurality of custom interfaces in the program body to allow the plugin to freely access various resources in the program. The advantage of this plug-in is that the degree of freedom is extremely degrees of freedom, which can exert the idea of plug-in developers. This plugin is a narrow range plug-in, which is also a plurality of plugins in the true sense. And this plug-in mechanism is relatively complex. It is difficult to coordinate between plug-in interfaces, and the development of plug-ins also requires professional programmers to do. This article mainly discusses the third type of plug-in, which utilizes a program plug-in that has been developed with an existing program. Second, the essence of the platform plug-in software design basic ideological plug-in is to expand and strengthen the software function without modifying the program body (platform). When the interface of the plugin is open, any company or individual can make its own plug-in to solve Some inconveniences or add new features, that is, to realize the "Plug and Play" software development. Platform plug-in software structure is divided into two parts, part of the program's objective software, which is the main body or main frame of the program, can be defined as a platform, and the other is a function extension or supplementary module, which can be defined as a plugin. Before the software development, the platform plug-in structure is used to develop software development, and it is necessary to determine according to the specific software requirements, but generally, software design will add new vitality to the developed software using the platform plug-in structure. When it is determined after the software structure of the platform plug-in, it is necessary to analyze which partial functions are completed by the main body, that is, the basic function of the platform, which part features are completed by the plugin, that is, the plugin feature that needs to be extended. The function completed by the platform should be the core and foundation of a software system. These basic functions can be used for users, or for plug-in, it is to divide the platform basic functions into two parts, kernel functions, and plug-in processing functions. The platform's kernel function is an important feature of the entire software, and most of the software is completed by the kernel function. The plugin processing function of the platform is used to extend the platform and management plug-in, providing a standard platform extension interface for the plugin manipulation platform and with plug-in communication. The function completed by the plug-in is the extension and supplement of the platform function. The general plug-in completes a series of functionality, for example: Photoshop's filter plug-in completes the special effects of the graphic, these features have some commonality, can be centralized, and You can define a standard plug-in interface. In order to implement the software design of the platform plug-in structure, two standard interfaces need to be defined, one for the platform extension interface implemented by the platform, one for the plugin interface implemented by the plugin. What is needed here is that the platform expansion interface is completely implemented by the platform, the plugin is only called and used, and the plugin interface is completely implemented by the plugin, and the platform is only called and used. The platform extension interface implements one-way communication in the plug-in to the platform direction. The plug-in can acquire various resources and data of the main frame through the platform extension, including various system handles, program internal data, and memory allocation. The plug-in interface is one-way communication in the plug-in direction, and the platform calls the plug-in to read the plug-in processing data, etc. Platform plug-in processing features include plug-in registration, management, and calls, and the functional implementation of platform extension interfaces.
The plug-in is registered to first search for the installed plugins in the system, then register the search in the platform and generate the corresponding call mechanism on the platform, including menu options, toolbar, internal calls, etc. The plug-in management completes the coordination of the plugin and platform, generates management information on the platform and the status tracking of the plugin. The plugin calls to call the functions implemented by each plug-in. Another part of the platform plug-in processing function is implemented for the specific implementation of the platform extension interface. Platform plug-in software design steps include: 1. Determine the basic function of the platform to complete the series of functionality or extensions; 2. Define platform expansion interfaces and plug-in interfaces; 3. Complete platform design, mainly platform plug-in processing function; 4, To the plug-in developer, the main platform program (execution code), the publishing platform extension interface and plug-in interface, may include the development of SDK; 5, plug-in developers can develop plugins as required, implement plug-in interface, developers can use The main platform program test plugin; 6, the main platform designer continues to complete the kernel function of the main platform, and will be announced at any time to increase the main platform expansion interface and plug-in interface; 7, achieve the benign loop of 4-6 steps, the entire software system is constantly Evolution forward. Platform plug-in software design Advantages: 1. Realize the "plug and play" of the real software components; 2. Integrated software in binary grade, reduce a large number of software recompile and release trouble and time; 3, can be very It is better to achieve the division of labor development of the software module, which can draw a lot of excellence in others; 4, it can better implement code hidden and protect intellectual property rights. Third, the COM-based prototype implementation platform plug-in software goals and design ideas have been clear, then what kind of methods and technologies implement plug-in (program plug-in), from the current design method of this, the design method of the software (Windows system Software), one is the implementation of the traditional DLL method, one is the implementation of the COM method. Below the next, a basic prototype frame design is implemented as COM technology. The principles of COM technology are quite familiar. This article introduces the relevant technical and methods of COM accordingly to implement the related technical and methods of COM accordingly. Overall prototype system development environment: Windows 2000, Visual C 7.0, the developments used include MFC and ATL. The plug-in registration To manage the plugin first is the registration mechanism for designing a plug-in, and through such a mechanism platform can be searched for all available plugins in the system, and the call points of each plug-in are generated on the platform. If you need to set a special identifier for each plug-in, with this identified plugin, the platform can be used. There is a very good way to implement the registration mechanism using COM, which is Component Category. The component directory is also a standard interface implemented by the COM (Interface, which is different from the interface mentioned in the platform plugin). When designing the COM component, only a directory classification information is defined, then you can search for a specific type of component in the system using a standard component directory interface, and the plugin registration and identification can be easily solved. After the plug-in management and calls get a specific identified component by the component directory, you need to generate a management mechanism for each plugin, each plugin has a class ID (CLSID), generating a class ID array for each plugin in the platform, each Each upset of a plug-in generates a menu item (dynamically generated menu item). Whether it is activated for each plugin, the platform has corresponding record information. The plugin call can be implemented by a menu message loop or internal call.
The platform extension interface and plug-in interface These two interfaces are different from interfaces in COM technology, but the platform extension interface and plug-in interface can be implemented using the interface definition of COM technology. On the implementation of the prototype system, the platform extension interface defines an iServer interface, and the plug-in interface defines an IPLUGIN interface. The iServer interface is used to pass the internal data interface for the plugin, and the IPLUGIN interface is used to read the plug-in functional information and is also used to transfer platform messages and resource handles. Messages, resources and data transfer platforms require a lot of messages and data interactions between plugins, including: various Windows messages, various Windows resource handles, and various internal data used by the system, sometimes need to be assigned memory. All messages and data interactions are implemented by the standard method defined by the platform extension interface and the plug-in interface, and the mouse message, window handle, device handle, and procedure within the prototype system have implemented delivery. Conclusion: The prototype system has implemented a general platform plug-in software development framework mode, which proves that this idea and design method can be applied to our specific software development. In this way, software cooperation development and integration issues can be solved well, which is more useful for software development of the version level. Advanced Software Installed Advanced Packments, low-grade software does not install advanced plugins, which gives programs and development brings great convenience. For software with serialization, the series is implemented by the plugin. Remarks: If you need source code information, please contact the author. (September 23, 2003)