Communication method and device between software modules, equipment and medium

By registering accessible or subscribed services when software modules are created and logging out when destroyed, the problems of high coupling and memory leaks in existing inter-module communication methods are solved, and flexible synchronous or asynchronous communication is achieved.

CN119512772APending Publication Date: 2025-02-25FACE CUTE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311086387.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-25
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The communication methods between existing software modules have security problems such as high coupling degree and memory leakage, and the communication methods are single, so it is impossible to flexibly switch to synchronous or asynchronous communication.

Method used

By registering accessible services or subscription services at the time of module creation and deregistering these services when modules are destroyed, the second module can find and access or subscribe to these services based on the interface, reducing the degree of coupling between modules and avoiding memory leaks.

Benefits of technology

It realizes the communication between modules through interfaces, reduces the coupling between modules, avoids memory leakage, and supports flexible synchronous or asynchronous communication methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512772A_ABST
    Figure CN119512772A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a communication method and device between software modules, equipment and a medium. A specific embodiment of the method comprises the steps that in response to creation of a first module, an accessible service of the first module is registered, and the first module is realized based on a preset first interface; and in response to destruction of the first module, cancelling the accessible service in the first module, and the second module searches whether the registered accessible service exists or not, and if the registered accessible service exists, the second module accesses the accessible service. Through the method, the modules for providing synchronous or asynchronous services can be limited through the implementation of the interface, so that the coupling degree between the modules is reduced, and the security problems such as memory leakage caused by reference between the modules with different life cycles are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of computer technology, and in particular, to a method, apparatus, device, and medium for communication between software modules. Background Art

[0002] The software modules included in the software or applications running on various computing terminals can usually communicate with each other in a variety of ways. For example, they can communicate through the event bus (EventBus), or directly call methods in other modules through references to other modules. However, these communication methods often have operational security issues such as uncertainty of communication data type, memory leaks, or inter-module structural problems that increase the coupling between modules.

[0003] Therefore, a new communication method between software modules is needed. Summary of the invention

[0004] The embodiments of the present disclosure describe a method, apparatus, device and medium for communication between software modules.

[0005] According to a first aspect, a method for communication between software modules is provided, comprising:

[0006] In response to creation of a first module based on a preset first interface implementation, registering an accessible service corresponding to the first interface in the first module; and in response to destruction of the first module, deregistering the accessible service;

[0007] The second module searches whether the accessible service is registered. If the accessible service is registered, the second module accesses the accessible service.

[0008] According to a second aspect, a method for communication between software modules is provided, comprising:

[0009] In response to creation of a first module based on a preset second interface implementation, registering a subscribable service corresponding to the second interface in the first module; and in response to destruction of the first module, unregistering the subscribable service;

[0010] The second module searches whether the subscribable service is registered. If the subscribable service is registered, the second module subscribes to the subscribable data of the subscribable service.

[0011] According to a third aspect, there is provided a communication device between software modules, comprising:

[0012] A first registration unit configured to, in response to creation of a first module based on a preset first interface implementation, register an accessible service corresponding to the first interface in the first module; and, in response to destruction of the first module, deregister the accessible service;

[0013] The access unit is configured to search, through the second module, whether there is a registered accessible service; if there is a registered accessible service, the second module accesses the accessible service.

[0014] According to a fourth aspect, there is provided a communication device between software modules, comprising:

[0015] A second registration unit is configured to, in response to creation of a first module based on a preset second interface implementation, register a subscribable service corresponding to the second interface in the first module; and, in response to destruction of the first module, unregister the subscribable service;

[0016] The subscription unit is configured to search, through the second module, whether there is a registered subscribable service. If there is a registered subscribable service, the second module subscribes to the subscribable data of the subscribable service.

[0017] According to a fifth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the methods of the first and second aspects.

[0018] According to a sixth aspect, an electronic device is provided, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the methods of the first and second aspects are implemented.

[0019] According to an embodiment of the present disclosure, a communication method, apparatus, device and medium between software modules are provided. In response to the creation of a first module, an accessible service or a subscribeable service of the first module can be registered, and the first module is implemented based on a preset first interface or a second interface; and in response to the destruction of the first module, the accessible service or the subscribeable service in the first module can be deregistered. Then, the second module searches whether there is a registered accessible service or a subscribeable service. If there is a registered accessible service or a subscribeable service, the second module accesses the accessible service or subscribes to the subscribeable data of the subscribeable service. Through this method, the modules that provide synchronous or asynchronous services can be limited by the implementation of the interface to reduce the coupling between modules and avoid security issues such as memory leaks caused by references between modules with different life cycles. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1A schematic diagram showing a communication method between software modules according to an embodiment of the present disclosure;

[0021] Figure 2 A schematic diagram showing a flow chart of a communication method between software modules according to an embodiment of the present disclosure;

[0022] Figure 3 (a) shows a schematic diagram of defining an accessible service interface according to an embodiment of the present disclosure;

[0023] Figure 3 (b) shows a schematic diagram of implementing an accessible service interface according to an embodiment of the present disclosure;

[0024] Figure 4 A schematic diagram showing a tree-like module relationship according to an embodiment of the present disclosure;

[0025] Figure 5 A schematic diagram of searching for accessible services according to an embodiment of the present disclosure is shown;

[0026] Figure 6 A schematic diagram showing accessing accessible services according to an embodiment of the present disclosure is shown;

[0027] Figure 7 A schematic diagram showing a flow chart of a communication method between software modules according to another embodiment of the present disclosure;

[0028] Figure 8 (a) shows a schematic diagram of defining a subscribable service interface according to an embodiment of the present disclosure;

[0029] Figure 8 (b) shows a schematic diagram of implementing a subscribeable service interface according to an embodiment of the present disclosure;

[0030] Fig. 9 A schematic diagram showing subscribing to subscribing data of a subscribing service according to an embodiment of the present disclosure is shown;

[0031] Fig.10 A schematic block diagram of a communication device between software modules according to an embodiment of the present disclosure is shown;

[0032] Fig.11 A schematic block diagram of a communication device between software modules according to another embodiment of the present disclosure is shown;

[0033] Fig.12 A schematic diagram of the structure of an electronic device suitable for implementing an embodiment of the present disclosure is shown;

[0034] Fig.13 A schematic diagram of the structure of a storage medium suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0035] The technical solution provided in this specification is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant inventions, rather than to limit the inventions. It should also be noted that, for ease of description, only the parts related to the relevant inventions are shown in the accompanying drawings. It should be noted that, in the absence of conflict, the embodiments of the present disclosure and the features in the embodiments can be combined with each other.

[0036] In the description of the implementations of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one / kind of implementation" or "the implementation" should be understood as "at least one / kind of implementation". The term "some implementations" should be understood as "at least some implementations". Other explicit and implicit definitions may also be included below.

[0037] As mentioned above, software modules included in software or applications running on different operating systems can usually communicate with each other through different schemes. For example, a module can communicate with other modules by directly calling methods in other modules through references to other modules. In one example, if module A has a reference to module B, it can directly access the data of module B or call methods in module B. Since through this communication scheme, the referencing module usually waits for the response sent back by the referenced module before executing the subsequent logical operations of the referenced module, the communication method in this scheme is also called synchronous communication method. For another example, software modules can also communicate through an event bus (EventBus). In one example, module C can publish events (Event) through EventBus, and module B can receive events through EventBus and perform corresponding logical operations after receiving the events. Since through this communication scheme, after the data sender (for example, the event publishing module) sends data (event), it can execute subsequent logical operations without waiting for the data receiver (for example, the event receiving module) to send back a response, the communication method in this scheme is also called asynchronous communication method.

[0038] However, the above-mentioned inter-module communication scheme also has the following problems: First, for example, direct references between modules. Due to the different life cycles of different modules, the referenced module may be destroyed, but the referenced module still exists, resulting in a reference error. It can also cause the referenced module to not be actually recycled at the recycling time, resulting in a memory leak. Second, for example, direct references between modules will increase the coupling between modules and reduce the logical independence of modules. This will increase the complexity of the relationship between modules and the difficulty of module maintenance. Third, for example, modules communicate through an event bus. Since the event bus usually does not restrict the event receiver and the type of the event or data sent, it can lead to the problem that the event sending range cannot be limited and the sent event or data is not easy to check. Fourth, the communication mode of the above-mentioned communication scheme is usually single, and can often only be fixed to one of synchronous communication or asynchronous communication, and cannot be changed to any one or both.

[0039] In order to solve the above technical problems, an embodiment of the present disclosure provides a communication method between software modules. Figure 1 FIG. 1 is a schematic diagram showing a method for communicating between software modules according to an embodiment of the present disclosure. Figure 1 As shown, in some embodiments, when a predetermined service interface (e.g., first interface) is implemented, for example, when a first module is created, for example, the accessible service of the first module can be registered; and when the first module is destroyed, the accessible service in the first module is deregistered. For example, if the second module needs to access the accessible service of the first module, it can find out whether there is a registered accessible service of the first module, and if so, the second module can access the accessible service of the first module. In other embodiments, when a predetermined first module such as the second interface is created, for example, the subscribeable service of the first module can be registered; and when the first module is destroyed, the subscribeable service in the first module can be deregistered. If the second module needs to obtain the subscribeable data of the subscribeable service, it can find out whether there is a registered subscribeable service of the first module, and if so, the second module can subscribe to the subscribeable data of the subscribeable service of the first module. In some other embodiments, for example, the first module can implement both the first interface and the second interface, so that when the first module is created, the accessible service and subscribeable service of the first module are registered; and when the first module is destroyed, the accessible service and subscribeable service in the first module are deregistered. For example, if the second module wants to access the accessible service of the first module or obtain the subscribable data of the subscribable service, it can check whether there is a registered accessible service or subscribable service of the first module. If so, the second module can access the accessible service of the first module or subscribe to the subscribable data of the subscribable service of the first module.

[0040] The advantages of this method are: first, the modules that can communicate are limited by the implementation of the interface, and the methods that can be accessed and the data that can be subscribed (for example, its data type or sending range) of the module can be constrained by the interface. Second, the accessible services and subscribed services of the module can be automatically registered and deregistered according to the life cycle of the module, and reference errors and memory leaks caused by references between modules with different life cycles will not occur. Third, the communication between different modules does not rely on direct references, but is limited by preset interfaces, which reduces the coupling between modules, thereby reducing the complexity of the relationship between modules and the difficulty of module maintenance. Fourth, the communication mode between modules can be set to either synchronous communication or asynchronous communication or both according to user usage habits or needs.

[0041] The detailed process of this method is further described below.

[0042] Figure 2 FIG. 1 is a flow chart showing a method for communicating between software modules according to an embodiment of the present disclosure. Figure 3 As shown, the method comprises at least the following steps:

[0043] Step S201, in response to the creation of a first module based on a preset first interface implementation, registering an accessible service corresponding to the first interface in the first module; and in response to the destruction of the first module, deregistering the accessible service;

[0044] Step S203: the second module searches whether there is a registered accessible service. If there is a registered accessible service, the second module accesses the accessible service.

[0045] First, in step S201, in response to creation of a first module based on a preset first interface implementation, an accessible service corresponding to the first interface in the first module is registered; and in response to destruction of the first module, the accessible service is deregistered.

[0046] An interface is usually a collection of method definitions, has a unique name, and can be inherited or implemented by a class or other interface. The first interface (or accessible service interface) can be used to define the specific methods (Method) included in the accessible service. In different specific embodiments, different methods of different accessible services can be defined in the first interface, and this specification does not limit this. Figure 3 (a) shows a schematic diagram of defining an accessible service interface according to an embodiment of the present disclosure. Figure 3As shown in (a), for example, an interface AccessibleService is defined, and the interface includes a method Fun1. A module implementing the interface can provide accessible services. Figure 3 (b) shows a schematic diagram of implementing an accessible service interface according to an embodiment of the present disclosure. Figure 3 As shown in (b), for example, the class defining the Assem1 module implements the interface AccessibleService, so that the Assem1 module can provide accessible services. In the above manner, the modules that can provide synchronous communication can be limited by whether the corresponding interface is implemented, and the methods that can be accessed by the module can be constrained by the interface.

[0047] In different embodiments, the specific methods of registering and deregistering accessible services may be different. In one embodiment, the first module may belong to multiple preset modules, and the inheritance relationships between the multiple preset modules and the preset modules constitute a tree-like inheritance relationship diagram. Each preset module has a corresponding service registration list, and the service registration list includes the service interface implemented by the currently created sub-module of the preset module and the mapping relationship between the currently created sub-module. Furthermore, in response to the creation of the first module, the mapping relationship between the first interface and the first module can be added to the service registration list corresponding to the parent module of the first module. And, in response to the destruction of the first module, the mapping relationship between the first interface and the first module is deleted in the service registration list corresponding to the parent module of the first module. Figure 4 FIG. 1 shows a schematic diagram of a tree-like module relationship according to an embodiment of the present disclosure. Figure 4In the example shown, for example, multiple modules Root Comp, Comp1~CompN, Comp1.1~Comp1.n..., and the inheritance relationship between these modules constitute a tree-like inheritance relationship diagram, where Root Comp is the root module, Comp1~CompN are submodules that inherit Root Comp, and Comp1.1~Comp1.n are submodules that inherit Comp1... Each module has a corresponding service registration list, which includes the service interface implemented by the currently created submodule of the module and the mapping relationship between the currently created submodule. For example, the service registration list corresponding to module Comp1 may include the service interface interf3 implemented by the currently created submodule Comp1.1 of module Comp1 and the mapping relationship between the submodule Comp1.1, and the service interface interf4 implemented by the currently created submodule Comp1.2 of module Comp1 and the mapping relationship between the submodule Comp1.2. As mentioned above, the submodules of the inherited module Comp1 may include Comp1.1 to Comp1.n, wherein any submodule (or instance of the submodule) can add the mapping relationship between the service interface implemented by the submodule and the submodule in the service registration list corresponding to Comp1 when it is created. And when the submodule is destroyed, the mapping relationship is deleted from the service registration list corresponding to Comp1. In this way, the accessible service of the first module can be automatically registered or deregistered when the first module is created or destroyed. In the above manner, the accessible service of the module can be automatically registered and deregistered according to the life cycle of the module. Therefore, reference errors and memory leaks caused by references between modules with different life cycles will not occur in subsequent steps.

[0048] Then, in step S203, the second module searches whether there is a registered accessible service. If there is a registered accessible service, the second module accesses the accessible service.

[0049] In the embodiment in which the above-mentioned multiple preset modules and the inheritance relationship between them constitute a tree-like inheritance relationship diagram, the second module may belong to the multiple preset modules. The second module may search from the service registration list corresponding to the predecessor module to see whether there is a mapping relationship between the first interface and the first module. If there is a mapping relationship between the first interface and the first module, the accessible service of the first module is accessed. The predecessor module of the second module refers to a module directly or indirectly inherited by the second module from multiple preset modules. In a specific embodiment, each predecessor module is accessed hierarchically upward from the predecessor module closest to the hierarchy. If there is a mapping relationship between the first interface and the first module in the service registration list of any predecessor module, it can be determined that there is an instance of the first module that has been created, and its accessible service is accessed through the instance. Figure 5 FIG. 2 shows a schematic diagram of searching for accessible services according to an embodiment of the present disclosure. Figure 5 As shown, for example, module Comp1.1 wants to access the accessible services of module Comp2. Comp1.1 can search for a mapping relationship between Comp2 and the service interface implemented by Comp2 from the service registration list corresponding to its upper-level predecessor module, such as Comp1. If the mapping relationship does not exist in the service registration list of Comp1, you can continue to search for the mapping relationship from the service registration list corresponding to the upper-level module of Comp1... until the root module Root Comp is found. If the mapping relationship exists in the service registration list of any of the predecessor modules, the search can be terminated. And determine that there is an instance created for the first module, and access its accessible services through the instance. If the mapping relationship cannot be found until the root module, the search can be abandoned. Figure 5 In the example shown, the service registration list of the root module Root Comp includes the mapping relationship between Comp2 and the service interface interf2 implemented by Comp2. Therefore, the module Comp1.1 can obtain the instance of Comp2 encapsulated by the first interface and call the method defined by the first interface, such as Fun1, of the instance. Figure 6 As shown in the above manner, the synchronous communication between different modules does not rely on direct reference, but is limited by the preset interface, which reduces the coupling between modules.

[0050] In the case that no accessible service is found, access to the service may be abandoned. Therefore, in one embodiment, if the registered accessible service does not exist, the second module may not access the accessible service.

[0051] Figure 7 FIG. 2 is a flow chart showing a method for communicating between software modules according to another embodiment of the present disclosure. Figure 7 As shown, the method comprises at least the following steps:

[0052] Step S701, in response to the creation of a first module based on a preset second interface implementation, registering a subscribable service corresponding to the second interface in the first module; and in response to the destruction of the first module, deregistering the subscribable service;

[0053] Step S703: the second module searches whether there is a registered subscribable service. If there is a registered subscribable service, the second module subscribes to the subscribable data of the subscribable service.

[0054] First, in step S701, in response to creation of a first module based on a preset second interface implementation, a subscribeable service corresponding to the second interface in the first module is registered; and in response to destruction of the first module, the subscribeable service is unregistered.

[0055] The second interface (or subscribeable service interface) can be used to define subscribeable data of the subscribeable service. In different specific embodiments, different subscribeable data of different subscribeable services can be defined in the second interface, and this specification does not limit this. Figure 8 (a) shows a schematic diagram of defining a subscribeable service interface according to an embodiment of the present disclosure. Figure 8 As shown in (a), for example, an interface ContentObservableService is defined, and the subscribeable data type of the interface is ContentData. A module implementing the interface can provide a subscribeable service. Figure 8 (b) shows a schematic diagram of implementing an accessible service interface according to an embodiment of the present disclosure. Figure 8 As shown in (b), for example, the class defining the Assem1 module implements the interface ContentObservableService, so that the subscribeable data of the subscribeable service of the Assem1 module can be subscribed by other modules. In the above manner, the modules that can provide asynchronous communication can be limited by whether the corresponding interface is implemented, and the data that can be subscribed by the module can be constrained by the interface.

[0056] In this step, the method of registering and deregistering the subscribable service can be similar to the method of registering and deregistering the accessible service in step S201. For a detailed description of the specific registration and deregistration methods, refer to the description of step S201, which will not be repeated here. In one embodiment, in response to the creation of the first module, the mapping relationship between the second interface and the first module can be added to the service registration list corresponding to the parent module of the first module. And, in response to the destruction of the first module, the mapping relationship between the second interface and the first module is deleted in the service registration list corresponding to the parent module of the first module.

[0057] Then, in step S703, the second module searches whether there is the subscribeable service registered. If there is the subscribeable service registered, the second module subscribes to the subscribeable data of the subscribeable service.

[0058] In this step, the method of searching for subscribable services may be similar to the method of searching for accessible services in step S203. For a detailed description of the specific searching method, refer to the description of step S201, which will not be repeated here. In one embodiment, the second module may belong to the plurality of preset modules, and the second module searches the service registration list corresponding to the predecessor module to find out whether there is a mapping relationship between the second interface and the first module. If there is a mapping relationship between the second interface and the first module, the subscribable data of the subscribable service is subscribed.

[0059] In one embodiment, after the second module subscribes to the subscribable data of the subscribable service, if the subscribable data changes, the second module may receive a notification of the change. Fig. 9 As shown, for example, when the module Assem2 subscribes to the subscribable data ContentData of ContentObservableService, it can receive a notification after the ContentData changes, and can also perform a corresponding operation (logic) after receiving the notification.

[0060] In one embodiment, if there is no registered subscribable service, the second module may not subscribe to the subscribable data of the subscribable service.

[0061] In different embodiments, accessible services and subscribeable services can be registered for the same module to provide both synchronous and asynchronous communication modes for the module. Therefore, in one embodiment, in step S701, in response to the creation of a first module based on a preset first interface and a second interface, an accessible service corresponding to the first interface and a subscribeable service corresponding to the second interface in the first module can be registered; and, in response to the destruction of the first module, the accessible service and the accessible service are deregistered. Furthermore, in step S703, the second module can search whether the subscribeable service is registered, and if the subscribeable service is registered, the second module subscribes to the subscribeable number of the subscribeable service, and / or search whether the accessible service is registered, and if the accessible service is registered, the second module accesses the accessible service.

[0062] Fig.10 A schematic block diagram of a communication device between software modules according to an embodiment of the present disclosure is shown. The device is used to perform the following steps: Figure 2 The method shown, such as Fig.10 As shown, the device 1000 includes:

[0063] The first registration unit 1001 is configured to, in response to the creation of a first module based on a preset first interface implementation, register an accessible service corresponding to the first interface in the first module; and, in response to the destruction of the first module, unregister the accessible service;

[0064] The access unit 1002 is configured to search, through the second module, whether the registered accessible service exists; if the registered accessible service exists, the second module accesses the accessible service.

[0065] Fig.11 A schematic block diagram of a communication device between software modules according to another embodiment of the present disclosure is shown. The device is used to perform the following steps: Figure 7 The method shown, such as Fig.11 As shown, the device 1100 includes:

[0066] The second registration unit 1101 is configured to, in response to the creation of the first module based on the preset second interface implementation, register the subscribable service corresponding to the second interface in the first module; and, in response to the destruction of the first module, unregister the subscribable service;

[0067] The subscription unit 1102 is configured to search, through the second module, whether there is the subscribeable service registered. If there is the subscribeable service registered, the second module subscribes to the subscribeable data of the subscribeable service.

[0068] The present disclosure also provides an electronic device, including a memory and a processor. The memory stores executable code. When the processor executes the executable code, the following is achieved: Figure 2 , Figure 7 The method shown.

[0069] You can also refer to the following Fig.12 , which shows a structural schematic diagram of an electronic device 1200 suitable for implementing an embodiment of the present application. Fig.12 The electronic device 1200 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0070] like Fig.12As shown, the electronic device 1200 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1201. The above-mentioned processing device 1201 may be a general-purpose processor, a digital signal processor (Digital Signal Processing, DSP), a microprocessor or a microcontroller, and may further include an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1202 or the program loaded from the storage device 1208 to the random access memory (RAM) 1203. In RAM1203, various programs and data required for the operation of the electronic device 1200 are also stored. The processing device 1201, ROM1202 and RAM1203 are connected to each other through a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.

[0071] Typically, the following devices may be connected to the I / O interface 1205: an input device 1206 including, for example, a touch screen, a touch pad, a keyboard, a mouse, etc.; an output device 1207 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1208 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1209. The communication device 1209 may allow the electronic device 1200 to communicate with other devices wirelessly or by wire to exchange data. Fig.12 The electronic device 1200 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 8 Each block shown in the figure may represent one device, or may represent multiple devices as required.

[0072] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1209, or installed from the storage device 1208, or installed from the ROM 1202. When the computer program is executed by the processing device 1201, the above-mentioned functions defined in the communication method between software modules provided in the embodiment of the present application are executed.

[0073] The present disclosure also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed in a computer, the computer is caused to execute the following steps provided in the present disclosure: Figure 2 , Figure 7 The communication method between software modules shown in . Fig.13 A schematic diagram of a storage medium for implementing an embodiment of the present application. Fig.13 As shown, the storage medium 1300 may be a non-transitory computer-readable storage medium for storing non-transitory computer-executable instructions 1301. When the non-transitory computer-executable instructions 1301 are executed by the processor, the communication method between software modules provided in the embodiment of the present application may be implemented. For example, when the non-transitory computer-executable instructions 1301 are executed by the processor, one or more steps in the communication method between software modules provided in the embodiment of the present application may be executed. For example, the storage medium 1300 may be applied to the above-mentioned electronic device. For example, the storage medium 1300 may include a memory in the electronic device. For the description of the storage medium 1300, reference may be made to the description of the memory in the embodiment of the electronic device, and the repetitions will not be repeated. The specific functions and technical effects of the storage medium 1300 may refer to the description of the communication method between software modules provided in the embodiment of the present application, and will not be repeated here.

[0074] It should be noted that the computer-readable medium of the embodiment of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a memory card of a smart phone, a storage component of a tablet computer, a portable computer disk, a hard disk of a personal computer, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In an embodiment of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In an embodiment of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0075] The computer-readable medium may be included in the electronic device, or may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the server, the electronic device implements the communication method between software modules provided in the embodiment of the present application.

[0076] Computer program code for performing the operations of the disclosed embodiments may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0077] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, which contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they may sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions. The units involved in the embodiments described in the present disclosure can be implemented by software or by hardware. Among them, the name of the unit does not constitute a limitation on the unit itself under certain circumstances. The functions described above in this article can be performed at least in part by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0078] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the storage medium and computing device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0079] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solution formed by the specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned public concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) to form a technical solution. In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Certain features described in the context of a single embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination.

[0080] The above specific implementation methods further describe in detail the purpose, technical solutions and beneficial effects of the embodiments of the present invention. Although the subject matter has been described in a language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. It should be understood that the above are only specific implementation methods of the embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.

Claims

1. A communication method between software modules, comprising: In response to creation of a first module implemented based on a preset first interface, registering an accessible service in the first module corresponding to the first interface; and, in response to the destruction of the first module, deregistering the accessible service; The second module searches whether the accessible service is registered. If the accessible service is registered, the second module accesses the accessible service.

2. The method according to claim 1, further comprising: If the registered accessible service does not exist, the second module does not access the accessible service.

3. The method according to claim 1, wherein: The first module belongs to a plurality of preset modules, and the inheritance relationship between the plurality of preset modules and the preset modules constitutes a tree-like inheritance relationship diagram, and each preset module has a corresponding service registration list, and the service registration list includes a mapping relationship between a service interface implemented by a currently created submodule of the preset module and the currently created submodule; In response to creation of a first module based on a preset first interface implementation, registering an accessible service corresponding to the first interface in the first module includes: In response to creation of the first module, adding a mapping relationship between the first interface and the first module in a service registration list corresponding to a parent module of the first module; In response to the destruction of the first module, deregistering the accessible service includes: In response to the destruction of the first module, the mapping relationship between the first interface and the first module is deleted in the service registration list corresponding to the parent module of the first module.

4. The method according to claim 3, wherein: The second module belongs to the plurality of preset modules, The second module searches whether the registered accessible service exists. If the registered accessible service exists, the second module accesses the accessible service, including: The second module searches the service registration list corresponding to the predecessor module to find out whether there is a mapping relationship between the first interface and the first module. If there is a mapping relationship between the first interface and the first module, the second module accesses the accessible service of the first module.

5. A communication method between software modules, comprising: In response to creation of a first module implemented based on a preset second interface, registering a subscribable service corresponding to the second interface in the first module; and, in response to the destruction of the first module, deregistering the subscribable service; The second module searches whether the subscribable service is registered. If the subscribable service is registered, the second module subscribes to the subscribable data of the subscribable service.

6. The method according to claim 5, further comprising: After the second module subscribes to the subscribable data of the subscribable service, if the subscribable data changes, the second module receives a notification of the change.

7. The method according to claim 5, further comprising: If the subscribeable service does not exist, the second module does not subscribe to the subscribeable data of the subscribeable service.

8. The method according to claim 5, wherein: The first module belongs to a plurality of preset modules, and the inheritance relationship between the plurality of preset modules and the preset modules constitutes a tree-like inheritance relationship diagram, and each preset module has a corresponding service registration list, and the service registration list includes a mapping relationship between a service interface implemented by a currently created submodule of the preset module and the currently created submodule; In response to creation of a first module based on a preset second interface implementation, registering a subscribable service corresponding to the second interface in the first module includes: In response to creation of the first module, adding a mapping relationship between the second interface and the first module in a service registration list corresponding to a parent module of the first module; In response to the destruction of the first module, deregistering the subscribeable service includes: In response to the destruction of the first module, the mapping relationship between the second interface and the first module is deleted in the service registration list corresponding to the parent module of the first module.

9. The method according to claim 8, wherein: The second module belongs to the plurality of preset modules, The second module searches whether the subscribable service is registered. If the subscribable service is registered, the second module subscribes to the subscribable data of the subscribable service, including: The second module searches the service registration list corresponding to the predecessor module to find out whether there is a mapping relationship between the second interface and the first module. If there is a mapping relationship between the second interface and the first module, the second module subscribes to the subscribable data of the subscribable service.

10. The method according to claim 5, wherein: In response to creation of a first module implemented based on a preset second interface, registering a subscribable service corresponding to the second interface in the first module; And, in response to the destruction of the first module, canceling the subscribeable service, comprising: In response to the creation of a first module implemented based on a preset first interface and a second interface, registering an accessible service corresponding to the first interface and a subscribable service corresponding to the second interface in the first module; and in response to the destruction of the first module, deregistering the accessible service and the subscribable service; The second module searches whether the subscribable service is registered. If the subscribable service is registered, the second module subscribes to the subscribable data of the subscribable service, including: The second module searches whether the subscribable service is registered, and if the subscribable service is registered, the second module subscribes to the subscribable data of the subscribable service; and / or, The second module searches whether the accessible service is registered. If the accessible service is registered, the second module accesses the accessible service.

11. A communication device between software modules, comprising: A first registration unit configured to, in response to creation of a first module implemented based on a preset first interface, register an accessible service in the first module corresponding to the first interface; and, in response to the destruction of the first module, deregistering the accessible service; The access unit is configured to search, through the second module, whether there is a registered accessible service; if there is a registered accessible service, the second module accesses the accessible service.

12. A communication device between software modules, comprising: A second registration unit is configured to, in response to creation of the first module based on the preset second interface implementation, register a subscribable service corresponding to the second interface in the first module; and, in response to the destruction of the first module, deregistering the subscribeable service; The subscription unit is configured to search, through the second module, whether there is the subscribeable service registered. If there is the subscribeable service registered, the second module subscribes to the subscribeable data of the subscribeable service.

13. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 10.

14. An electronic device comprising a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 10 is implemented.