Code reuse method and device

By building a plug-in management platform and orchestrating and calling business plug-ins, the problems of poor readability and low maintenance of existing business application systems are solved, code reuse and business decoupling are realized, and the flexibility and scalability of the system are improved.

CN119556916APending Publication Date: 2025-03-04CHINA PETROLEUM & CHEMICAL CORP +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411605760.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

The readability of existing business application systems is extremely poor and maintainability is reduced. Especially when the business is complex, traditional front-end development and separate domain service modules are difficult to effectively combine and reuse.

Method used

By building a plug-in management platform, receiving and registering business plug-ins, orchestrating and calling plug-ins that have been successfully registered, pushing process rules, and sending call requests when needed, the plug-in reusability is achieved.

Benefits of technology

It reduces development difficulty, improves code reuse efficiency, reduces business and code coupling, enables the system to run flexibly, quickly and conveniently, and supports the scalability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119556916A_ABST
    Figure CN119556916A_ABST
Patent Text Reader

Abstract

The invention provides a code reuse method and device. The problems that a traditional service application system is extremely poor in readability and low in maintainability are solved. The code reuse method comprises the following steps: building a plug-in management platform; receiving a service plug-in, and registering and managing the service plug-in; arranging and calling the successfully registered service plug-ins, and pushing flow rules of the arranged service plug-ins; receiving a first calling request, and verifying the availability of the service plug-in; and after verification is completed, a second calling request is sent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software development, and in particular to a code reuse method and device. Background Art

[0002] With the continuous development of network technology and the intensification of enterprise informatization, the architecture evolution of application systems has become increasingly complex with business uncertainty and diversity, requiring more thinking and higher-dimensional abstraction. By separating organizational logic from business implementation, business applications can focus more on their own domain content. Most current systems use prosperous codes to assemble business logic. When the business becomes extremely complex, it becomes extremely difficult to read and maintain.

[0003] There are generally two traditional approaches to application systems today. One is to complete it directly in the front-end development, and the other is to add a separate domain service module to implement the domain service API capability interface across microservice centers. If the service combination is implemented on the front end, there are two problems. First, the front-end development often does not care too much about the detailed business rules and logic, and letting the front end to combine often leads to errors in the key business implementation logic; second, after the front-end combination, this part of the content will be difficult to reuse. For example, when there are both BS and APP ends, this part of the content often needs to be implemented twice at the same time. Therefore, it is more suitable to solve these problems in the back-end development. If the back-end is used to solve the traditional monolithic application and is divided into multiple independent microservice centers, developers are often only familiar with the microservice module business they are responsible for. Therefore, even if the back-end is to do it, it requires personnel who are familiar with the overall business and application architecture to complete it, which is not easy to develop. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a code reuse method and device, which solves the problem of extremely poor readability and reduced maintainability of traditional business application systems.

[0005] In a first aspect, an embodiment of the present invention provides a code reuse method, comprising:

[0006] Build a plug-in management platform;

[0007] Receive a service plug-in, register and manage the service plug-in;

[0008] Arrange and call the successfully registered business plug-in, and push the process rules of the business plug-in that has been orchestrated;

[0009] receiving a first call request and verifying the availability of the service plug-in;

[0010] After the verification is completed, a second call request is sent.

[0011] In one implementation, after sending the second call request, the method further includes: receiving a first call success instruction, and sending the second call success instruction.

[0012] In one implementation, the service plug-in includes at least one of a script plug-in, a data storage plug-in, and a call plug-in.

[0013] In one implementation, the orchestration call includes at least one of a serial call, a parallel call, a conditional call, an asynchronous call, and a loop call.

[0014] In a second aspect, an embodiment of the present invention provides a code reuse method, which is applied to a business service end, including:

[0015] Writing a service plug-in and sending the service plug-in;

[0016] Receive the second call request and execute the corresponding plug-in service.

[0017] In a third aspect, an embodiment of the present invention provides a code reuse method, which is applied to a plug-in execution end, receives a process rule of the business plug-in, and verifies the process rule of the business plug-in;

[0018] After successful verification, the first call request is sent in the order of the process rules of the business plug-in.

[0019] In one embodiment, after sending the first call request, the method further includes: receiving a second call success instruction, and executing the call logic of the next plug-in.

[0020] In a fourth aspect, an embodiment of the present invention provides a code multiplexing device, including:

[0021] Platform building module, used to build a plug-in management platform;

[0022] The receiving module is used to receive the service plug-in and receive the first call request;

[0023] A registration management module, used to register and manage the service plug-in;

[0024] An orchestration calling module, used for orchestrating and calling the successfully registered service plug-in;

[0025] A sending module, used for sending the process rules of the business plug-in that have been arranged; sending a second call request;

[0026] The verification module is used to verify the availability of the service plug-in.

[0027] In a fifth aspect, an embodiment of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the code reuse method as described above.

[0028] In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it is used to implement the code reuse method as described above.

[0029] The code reuse method and device provided by the embodiment of the present invention can reduce development, reuse code, improve efficiency, achieve decoupling between services, and also meet the requirements of free combination of functions based on interfaces and customized transactions to improve the complexity of system calls and the serious dependence of modules and services. Based on plug-in-based service arrangement, from point to line, it reduces the coupling of services and codes, manages and applies general plug-ins, improves the reuse of code assets, and ensures that the system can run flexibly, quickly, and conveniently. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 FIG. 1 is a flow chart of a code reuse method provided by an embodiment of the present invention.

[0031] Figure 2 FIG. 4 is a schematic diagram of the structure of a code multiplexing device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0033] Compared with the existing traditional technical solutions, mature products with clear functions and products with unclear functions for enterprises or units have some common characteristics. Most of the logical functions are the same. These functions may be used in many systems and need to be maintained. It is impossible to maintain a function by modifying N systems. Modifying a part of the function will not affect other functions and can be launched at any time. The cost of full site regression is too high. The biggest advantage of plug-in is that it is divided according to functions, the system coupling is low, and the addition or deletion of a function does not affect the use of other functions. Each part of the system is just a plug-in, and all parts are at the same level. The GUI may be used to load and guide the framework to start, but it must also be a plug-in to be called by other components. Circular dependencies between components are possible. If all functions are packaged in one project, it is simple and reliable, but the scalability is extremely poor. The cost of extending functions is very high, but the efficiency and code volume are small. If each function is split into components and components call each other, the coupling of the system can be reduced, but a lot of data transfer code is added.

[0034] In existing software development, the business is becoming more and more complex, the code size is getting larger and larger, and the manpower required is increasing. In order to reduce the internal coupling of system modules, reduce the difficulty of development, and support parallel development of multiple teams. After using the technical solution of the present invention, the business expansion and transformation of old systems or the expansion of new systems can be carried out conveniently. Figure 1 As shown, the specific implementation is as follows.

[0035] This embodiment provides a code reuse method, which is applied to a plug-in management end. The code reuse method includes:

[0036] Step 11: Build a plug-in management platform. The plug-in management platform is used for plug-in query, management, and maintenance.

[0037] Step 12: Receive the service plug-in, register and manage the service plug-in.

[0038] The plug-in management end receives the business plug-ins written by users, and the business plug-ins are automatically registered to the plug-in management end and hosted.

[0039] Optionally, the business plug-in includes but is not limited to a script plug-in, a data storage plug-in and a call plug-in.

[0040] Step 13: orchestrate the call of the successfully registered service plug-in, and push the process rules of the service plug-in that has been orchestrated.

[0041] The successfully registered service plug-in is orchestrated and called. Optionally, the orchestrated call includes but is not limited to serial call, parallel call, conditional call, asynchronous call, and cyclic call.

[0042] Step 14: Receive the first call request and verify the availability of the service plug-in.

[0043] The plug-in management end receives a first call request sent by the plug-in management end, and performs a service plug-in verification.

[0044] Step 15: After verification is completed, send a second call request.

[0045] After verifying the availability of the service plug-in, a second call request is sent to the service server.

[0046] After sending the second call request, the method further includes step 16: receiving a first call success instruction, and sending the second call success instruction.

[0047] This embodiment provides a code reuse method, which is applied to a business service end. The code reuse method includes:

[0048] Step 21: Write a service plug-in and send the service plug-in.

[0049] Step 22: Receive the second call request and execute the corresponding plug-in service.

[0050] This embodiment provides a code reuse method, which is applied to a plug-in execution end. The code reuse method includes:

[0051] Step 31: receiving the process rule of the service plug-in and verifying the process rule of the service plug-in;

[0052] Step 32: After the verification is successful, the first call request is sent in the order of the process rules of the business plug-in.

[0053] After sending the first call request, the method further includes step 33: receiving a second call success instruction and executing the call logic of the next plug-in.

[0054] This embodiment provides a code reuse method, such as Figure 1 As shown, the code reuse method includes:

[0055] Step 01: Build a plug-in management platform to prepare for plug-in query, management, and maintenance.

[0056] Step 02: Business plug-ins can be written on the business service end, including but not limited to script plug-ins, data storage plug-ins, call plug-ins, etc. The business service end sends the written business plug-in to the plug-in management end, and then the business plug-in will be automatically registered with the plug-in management end and the plug-in will be managed.

[0057] Step 03: The plug-in management end can arrange and call the successfully registered business plug-in; the arrangement call includes but is not limited to serial call, parallel call, conditional call, asynchronous call, and loop call.

[0058] Step 04: The completed plug-in process rules will be pushed to the plug-in execution end. After the plug-in execution end verifies the rules successfully, it will call the plug-in management end according to the order of the rules.

[0059] Step 05: After the plug-in management end receives the first call request sent by the plug-in execution end, the plug-in management end verifies the plug-in availability, and then sends a second call request to the business service end.

[0060] Step 06: After receiving the second call request, the business server executes the corresponding plug-in business and returns a call success response to the plug-in manager if successful.

[0061] Step 07: The plug-in management end receives the call success response and pushes the call success response to the plug-in execution end, which then performs the call logic of the next plug-in.

[0062] The present invention provides a plug-in code asset reuse method and device. First, a plug-in management platform is built, and all business services are registered on the plug-in management end. Then, the business services of the system are parsed through service orchestration and system business rules. Then, when needed, the required business module plug-ins are called by the plug-in executor according to the executor verification rule sequence. The management officer receives the signal from the execution end, sends a call request to the business end, and executes it in the execution sequence. The business and code coupling is reduced from point to line, thereby ensuring that the system can run flexibly, quickly, and conveniently and ensuring the scalability of the system.

[0063] This embodiment provides a code multiplexing device 100, such as Figure 2 As shown, the code reuse device 100 is a plug-in management terminal, including: a platform building module 10, a receiving module 20, a registration management module 30, an orchestration calling module 40, a sending module 50 and a verification module 60. Among them:

[0064] The platform building module 10 is used to build a plug-in management platform;

[0065] The receiving module 20 is used to receive the service plug-in; receive the first call request;

[0066] The registration management module 30 is used to register and manage the service plug-in;

[0067] The orchestration calling module 40 is used to orchestrate the calling of the successfully registered service plug-in;

[0068] The sending module 50 is used to send the process rules of the business plug-in that have been arranged; send a second call request;

[0069] The verification module 60 is used to verify the availability of the service plug-in.

[0070] This embodiment provides a code reuse device, which is a service server, including: a writing module, a service plug-in sending module, a call request receiving module and a plug-in module.

[0071] The writing module is used to write business plug-ins;

[0072] The service plug-in sending module is used to send the service plug-in;

[0073] The call request receiving module is used to receive a second call request;

[0074] The plug-in module is used to execute the corresponding plug-in business.

[0075] This embodiment provides a code reuse device, which is a plug-in execution end, including: a business plug-in process rule receiving module, a business plug-in process rule checking module, a first call request sending module and a call success instruction receiving module.

[0076] The process rule receiving module of the business plug-in is used to receive the process rule of the business plug-in;

[0077] The process rule verification module of the business plug-in is used to verify the process rule of the business plug-in;

[0078] The first call request sending module is used to send the first call request in the order of the process rules of the business plug-in;

[0079] The call success instruction receiving module is used to receive the second call success instruction, and after receiving the second call success instruction, the call logic of the next plug-in can be executed.

[0080] This embodiment provides an electronic device, which may be a mobile phone, a computer or a tablet computer, etc., including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the code reuse method described in Embodiment 1 is implemented. It is understood that the electronic device may also include an input / output (I / O) interface and a communication component.

[0081] The processor is used to execute all or part of the steps in the code reuse method in Embodiment 1. The memory is used to store various types of data, which may include instructions of any application or method in the electronic device, and data related to the application.

[0082] The processor can be an application specific integrated circuit (ASIC), a digital signal processor (DSP), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller, a microprocessor or other electronic components, and is used to execute the code reuse method in the above-mentioned embodiment 1.

[0083] The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0084] This embodiment also provides a computer-readable storage medium. Each functional unit in each embodiment of the present invention may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. If the function is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium.

[0085] Based on such understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.

[0086] The aforementioned storage media include: flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, server, APP application store, etc. Various media that can store program verification codes, on which computer programs are stored, and the computer program can implement the above method steps when executed by the processor.

[0087] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0088] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the scheme of this embodiment.

[0089] The basic principles of the present application are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present application are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present application. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, not for limitation, and the above details do not limit the present application to being implemented by adopting the above specific details.

[0090] The block diagrams of devices, apparatuses, equipment, and systems involved in this application are only illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems may be connected, arranged, or configured in any manner.

[0091] It should also be noted that in the apparatus, device and method of the present application, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present application.

[0092] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present application. Therefore, the present application is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0093] In the description of the application, the meaning of "multiple" is at least two, for example, two, three, etc., unless otherwise clearly and specifically limited. In the embodiment of the present application, all directional indications (such as up, down, left, right, front, back, top, bottom ...) are only used to explain the relative position relationship, motion conditions, etc. between the components under a certain specific posture (as shown in the drawings). If the specific posture changes, the directional indication also changes accordingly. In addition, the terms "including" and "having" and any of their deformations are intended to cover non-exclusive inclusions. For example, the process, method, system, product or equipment comprising a series of steps or units are not limited to the steps or units listed, but optionally also include the steps or units not listed, or optionally also include other steps or units inherent to these processes, methods, products or equipment.

[0094] In addition, the reference to "embodiment" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiment may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0095] The above is only a specific implementation of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims. The above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A code reuse method, applied to a plug-in management end, characterized in that: include: Build a plug-in management platform; Receive a service plug-in, register and manage the service plug-in; Arrange and call the successfully registered business plug-in, and push the process rules of the business plug-in that has been orchestrated; receiving a first call request and verifying the availability of the service plug-in; After the verification is completed, a second call request is sent.

2. The code reuse method according to claim 1, characterized in that: After sending the second call request, the method further includes: receiving a first call success instruction, and sending the second call success instruction.

3. The code reuse method according to claim 1, characterized in that: The business plug-in includes: at least one of a script plug-in, a data storage plug-in and a call plug-in.

4. The code reuse method according to claim 1, characterized in that: The orchestration call includes: at least one of serial call, parallel call, conditional call, asynchronous call and loop call.

5. A code reuse method, applied to a business service end, characterized in that: include: Writing a service plug-in and sending the service plug-in; Receive the second call request and execute the corresponding plug-in service.

6. A code reuse method, applied to a plug-in execution end, characterized in that: include: Receiving the process rule of the service plug-in and verifying the process rule of the service plug-in; After successful verification, the first call request is sent in the order of the process rules of the business plug-in.

7. The code reuse method according to claim 6, characterized in that: After sending the first call request, the method further includes: receiving a second call success instruction, and executing the call logic of the next plug-in.

8. A code multiplexing device, characterized in that: include: Platform building module, used to build a plug-in management platform; The receiving module is used to receive the service plug-in; receiving a first call request; A registration management module, used to register and manage the service plug-in; An orchestration calling module, used for orchestrating and calling the successfully registered service plug-in; A sending module, used for sending the process rules of the business plug-in that have been completed; Sending a second call request; The verification module is used to verify the availability of the service plug-in.

9. An electronic device, characterized in that: It comprises a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the code reuse method as described in any one of claims 1-4 or 5 or 6-7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it is used to implement the code reuse method as described in any one of claims 1-4 or 5 or 6-7.