CN107203419B - Method, device and system for calling among modules in application program - Google Patents

Method, device and system for calling among modules in application program Download PDF

Info

Publication number
CN107203419B
CN107203419B CN201610154054.2A CN201610154054A CN107203419B CN 107203419 B CN107203419 B CN 107203419B CN 201610154054 A CN201610154054 A CN 201610154054A CN 107203419 B CN107203419 B CN 107203419B
Authority
CN
China
Prior art keywords
module
service
basic function
event
interface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610154054.2A
Other languages
Chinese (zh)
Other versions
CN107203419A (en
Inventor
秦诗杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610154054.2A priority Critical patent/CN107203419B/en
Publication of CN107203419A publication Critical patent/CN107203419A/en
Application granted granted Critical
Publication of CN107203419B publication Critical patent/CN107203419B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

Abstract

The embodiment of the application discloses a method, a device and a system for calling modules in an application program, wherein the system comprises: the framework core module is used for maintaining context information related to the application program and providing an event perception interface; the context information is used for sharing among the module resources; the service module is used for sensing an event through an event sensing interface of the frame core module and initiating a calling request to a service interface corresponding to a target event when the target event is sensed; and the service interface is used for calling the corresponding basic function module according to the calling request of the service module, transmitting the parameters in the calling request to the basic function module, and returning the processing result to the service module after receiving the processing result returned by the basic function module. Through the embodiment of the application, the multiplexing cost of the module can be reduced, and the flexibility of the module is improved.

Description

Method, device and system for calling among modules in application program
Technical Field
The present application relates to the field of application development technologies, and in particular, to a method, an apparatus, and a system for inter-module calling in an application.
Background
With the development of mobile communication and internet technologies, various mobile terminal applications (generally referred to as apps) are emerging to facilitate users' lives, works, and the like in various industries, including e-commerce apps such as panning, tianmao, money-gathering, and the like.
In the field of mobile terminal application development, common mobile terminal operating systems include iOS (mobile operating system developed by apple inc.), Android (operating system based on Linux free and open source code), and the like. For different operating systems, App development needs to be performed in different modes. The UIapplication is the start of the iOS application and is responsible for initializing, displaying UIWindow and loading the first UIView of the application into an UIWindow window. Another task of UIapplication is to help manage the lifecycle of an application, and UIapplication fulfills this task through a proxy class named UIApplicationDelegate. Although the UIapplication may be responsible for receiving events, how to respond to these events is determined by the UIapplicationDelegate, which may handle events including application lifecycle events (such as program start and shut down, etc.), system events (such as incoming calls, note alerts, etc.), and so forth.
In order to realize code multiplexing and reduce development cost, modular development can be realized under the existing iOS development framework. For example, an application may be divided into a plurality of basic function modules and a plurality of business modules. The basic function module may include a module for logging in, a module for recording a trace of user operation behavior, and the like. Most of the business modules are defined in a user-oriented manner, for example, for an App client of "tianmao", specific business modules may include a "tianmao" home page, a "shopping cart" page, and the like. Therefore, if the "tianmao" home page and the "shopping cart" page both need to use the login function, the login function can be called to realize the purpose, so that the code of the same basic function module can be reused among different service modules.
In the prior art, a service module needs to sense a specific system event through a native interface of an operating system, and after a certain event is sensed, a specific basic function module needs to be directly called to realize a specific function. For example, the "home" module may determine whether the user is logged in through a native interface of the system when the login function needs to be used, and the like, and if not, directly call the login module so that the user can log in, and the like.
In order to implement the call of the service module to the basic function module to process the system event, a class inherited from the uiapplicationdelete interface is usually written, so that a lot of codes of the service module are doped in the uiapplicationdelete. That is, given that the "shopping cart" module requires the use of a login function, some of the code used to invoke the login module needs to be associated with the shopping cart module, the invocation code of the module may need to be modified once the base module is updated or extensive code modification occurs, and so on. In short, the strong association between the service module and the basic function module may cause the call sequence between the modules to be disordered, the coupling degree between the modules to be relatively high, and the multiplexing cost of the modules to be high.
Therefore, how to reduce the multiplexing cost of the module and improve the flexibility of the module becomes a technical problem to be solved by those skilled in the art.
Disclosure of Invention
The application provides a method, a device and a system for calling among modules in an application program, which can reduce the multiplexing cost of the modules and improve the flexibility of the modules.
The application provides the following scheme:
an inter-module call system in an application, the system comprising: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface; wherein:
the framework core module is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
the service module is used for sensing an event through an event sensing interface of the frame core module, and initiating a calling request to a service interface corresponding to a target event when the target event is sensed;
the service interface is used for calling the corresponding basic function module according to the calling request of the service module, transmitting the parameters in the calling request to the basic function module, and returning the processing result to the service module after receiving the processing result returned by the basic function module;
and the basic function module is used for executing corresponding processing according to the parameters transmitted by the service interface and returning a processing result to the service interface.
An inter-module calling method in an application program comprises the following steps:
the application program comprises: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface;
the method comprises the following steps:
the framework core module maintains context information related to the application program and provides an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
when a target event is sensed, providing the target event information to a registered service module of an event sensing interface for realizing the target event, so that the service module initiates a calling request to a service interface corresponding to the target event after sensing the target event, the service interface calls a corresponding basic function module, transmits parameters in the calling request to the basic function module, and returns a processing result to the service module after receiving the processing result returned by the basic function module.
An inter-module calling method in an application program comprises the following steps:
the application program comprises: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface; the framework core module is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
the method comprises the following steps:
the service module carries out event perception by realizing an event perception interface of the framework core module;
when a target event is sensed, judging whether a service interface corresponding to the target event is registered or not according to the context information;
if the service interface is registered, a calling request is sent to the service interface so that the service interface can call the corresponding basic function module, parameters in the calling request are transmitted to the basic function module, and after a processing result returned by the basic function module is received, the processing result is returned to the service module.
An inter-module calling method in an application program comprises the following steps:
the application program comprises: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface; the framework core module is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
the method comprises the following steps:
the service interface receives a calling request of the service module and judges whether the corresponding basic function module is registered according to the context information;
if the basic function module is registered, the basic function module is called, parameters in a calling request are transmitted to the basic function module, and after a processing result returned by the basic function module is received, the processing result is returned to the service module.
An inter-module calling apparatus in an application:
the application program comprises: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface;
the device is applied to a frame core module and comprises:
the context information maintenance unit is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
and the interaction unit is used for providing the target event information to a registered service module of an event perception interface realizing the target event when the target event is perceived, so that the service module initiates a calling request to a service interface corresponding to the target event after perceiving the target event, the service interface calls a corresponding basic function module, parameters in the calling request are transmitted to the basic function module, and after a processing result returned by the basic function module is received, the processing result is returned to the service module.
An inter-module calling apparatus in an application:
the application program comprises: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface; the framework core module is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
the device is applied to a business module and comprises:
the event perception unit is used for perceiving events through an event perception interface which realizes the framework core module;
the judging unit is used for judging whether a service interface corresponding to the target event is registered or not according to the context information when the target event is sensed;
and the calling unit is used for initiating a calling request to the service interface if the service interface is registered so that the service interface can call the corresponding basic function module, transmitting the parameters in the calling request to the basic function module, and returning the processing result to the service module after receiving the processing result returned by the basic function module.
An inter-module calling apparatus in an application:
the application program comprises: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface; the framework core module is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
the device is applied to a service interface and comprises:
a call request receiving unit, configured to receive a call request of a service module, and determine whether a corresponding basic function module is registered according to the context information;
and the calling unit is used for calling the basic function module if the basic function module is registered, transmitting parameters in the calling request to the basic function module, and returning a processing result to the service module after receiving the processing result returned by the basic function module.
According to the specific embodiments provided herein, the present application discloses the following technical effects:
according to the embodiment of the application, an application program framework can be provided, context information in the application program is provided for each module through the framework core module, interaction can be carried out between the framework core module and the service module through the event perception interface, and the service module can perceive various events through the event perception interface of the framework core module. After the event is sensed, if the function of the basic function module needs to be used, the indirect calling of the basic function module can be realized through the service interface corresponding to the basic function module, so that the service module and the basic function module do not have strong association any more, the coupling degree between the service module and the basic function module is reduced, and the multiplexing cost can be reduced in the process of multiplexing the basic function module codes by different service modules. In addition, since the plug-in management of each module can be realized, the modules can be added or deleted without affecting other modules, and the flexibility of the modules is improved.
Of course, it is not necessary for any product to achieve all of the above-described advantages at the same time for the practice of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a schematic diagram of a system provided by an embodiment of the present application;
FIG. 2 is a schematic diagram of application lifecycle events;
FIG. 3 is a schematic diagram of another lifecycle event of an application;
FIG. 4 is a flow chart of a first method provided by an embodiment of the present application;
FIG. 5 is a flow chart of a second method provided by embodiments of the present application;
FIG. 6 is a flow chart of a third method provided by embodiments of the present application;
FIG. 7 is a schematic diagram of a first apparatus provided by an embodiment of the present application;
FIG. 8 is a schematic diagram of a second apparatus provided by an embodiment of the present application;
fig. 9 is a schematic diagram of a third apparatus provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments that can be derived from the embodiments given herein by a person of ordinary skill in the art are intended to be within the scope of the present disclosure.
In the embodiment of the present application, firstly, a modular programming solution framework solution is provided, which can run under an ios system, and the framework can be referred to as BeeHive. The method can be used for realizing modularization of large-scale application, programming complexity and dependence coupling degree are reduced, the flexibility of the module is higher, and the module can be easily added or deleted by an application program. Specifically, the framework is located between an operating system and an application program, and when an event is sensed, a business module in the application program does not need to be implemented through a native interface of the operating system any more, but only needs to be implemented through an interface provided by a core of the framework. When calling operation is carried out among other basic function modules, other basic function modules are not required to be called by inheriting the class of the original UIApplicationDelegate interface of the operating system, a respective service interface is realized for each basic function module, when a certain function needs to be used by a service module, a request can be sent to the service interface of the corresponding basic function module by the service module, correspondingly, the service interface forwards the request to the basic function module, the basic function module processes the request after receiving the request, returns the processing result to the service interface, and returns the processing result to the service module by the service interface. The module resources can realize plug-in programming, and the module resources do not have any dependence or strong association, and the framework content and the module resources are interacted through events, so that plug-in isolation is realized. In addition, the access through the service interface has the advantage that the change of the service interface can be checked and found during compiling, so that the problem of the service interface can be corrected in time.
It can be seen that, in the embodiment of the present application, resources in an application program include, in addition to module resources, service interface resources, where the service interface resources correspond to basic function modules, and in a specific implementation, one basic function module may correspond to multiple service interfaces and respectively correspond to different calling modes, that is, the basic function module may be called in different calling modes through different service interfaces. The module resource and the service interface resource may be defined in a BeeHive framework, and are registered with a framework core module, after the registration is successful, the service module obtains the capability of sensing the corresponding event, and the service interface may be called by the service module, and so on. In addition, new module resources or service interface resources can be added to the framework at will, for example, a new business module can be added to the application program to provide more services to the user, or a new service interface can be added when a new calling mode appears in the basic function module, and the like, and in the process, processing logic of other modules does not need to be modified, so that development cost can be reduced.
Example one
Referring to fig. 1, a first embodiment of the present application first provides a system for inter-module calling in an application, where the system includes: the framework comprises a framework core module 101, module resources 102 and a service interface 103, wherein the module resources 102 comprise a basic function module 1021 and a business module 1022, and the basic function module 1021 corresponds to the service interface 103. In specific implementation, the framework core module can be added into an application program, and each business module, basic function module and service interface can be compiled based on the framework core module according to actual needs. Wherein:
the framework core module 101 is configured to maintain context information related to an application program and provide an event-aware interface; the context information comprises the running environment information and the configuration parameter information of the application program, and the registration information of the module resource and the service interface.
First, the framework core module 101 may provide a piece of global context information, which may include running environment information of the application, configuration parameter information, and registration information of module resources and service interfaces, etc. That is to say, the framework core module may record and maintain information such as the operating environment and configuration parameters of the application program, and the service module, the basic function module, the service interface, and the like of the application program may be registered in the framework core module, and the framework core module may also record registration information of each module and service, and the like. In this way, the context information can be shared among the modules, so that the modules can acquire the corresponding information. In specific implementation, when initializing the context of the application, the context may be implemented in the did finishlaunchwithoption in the uiapplicationdelete, and specifically, the relevant parameters during setting the context initialization may be executed, and the corresponding operations such as the BeeHive frame may be started.
In one implementation mode, a developer can directly write the identifier such as the name of the module resource or the service interface into a static registration file inside the framework core module, so that the framework core module can directly perform static registration on the module resource or the service interface according to the module name or the service name recorded in the file. For example, the static registration file may be referred to as beehive.
Or, in another implementation, when a module resource or a service interface is initialized, a registration request may be initiated by calling a registration interface of the framework core module, and correspondingly, the framework core module may perform dynamic registration on the corresponding module resource or service interface according to the received registration request. For example, the MODULE resource may implement a BH _ exit _ MODULE () macro at the MODULE entry, declare this type as a MODULE entry implementation class, and if the MODULE needs to be set to asynchronous loading, set BH _ exit _ MODULE (YES) to YES, may initialize an asynchronous execution MODULE between first-screen content presentations after the application is started, so as to optimize the start time consumption.
The interaction between the framework core module and the service module is realized through an event-aware interface. In specific implementation, the framework core module can also provide an event awareness interface for each service module, and the service module can know the occurrence of a specific event by implementing the event awareness interface. For example, specific event interfaces may include, but are not limited to:
- (void) modInit (BHContext) context (initializing service module event)
- (void) modSetup (BHContext) context (set service Module parameter event)
- (void) modTerDown (BHContext) context (event called when application was destroyed)
- (void) modWillResignActive (BHContext) ((BHContext)) (an event called when an application is about to enter an inactive state for execution)
- (void) modDidEnterBackground (BHContext) context (an event called when an application is pushed to the background)
- (void) modWillEntereForeground (BHContext) ((BHContext)) (an event called when an application is going to come back to the foreground from the background)
The specific event may include a basic system event, that is, a lifecycle event of the application program. For example, referring to FIG. 2, in the case of an application program being normally launched, system events within the lifecycle typically include: a to-start (WillLaunch) event, a to-start (didLaunch) event, an enter foreground phase (Eventloop) event, an execute (willresognignactive) event when an inactive state is to be entered, a background phase (didnterbackground) event is to be entered, an active state (WillEnterForeground) event is to be entered, a foreground active (didbeclomeactive) event is to be entered, and a willtermate event is to be exited. In specific implementation, the framework core module may provide interfaces for sensing various system events, and the service module may implement some or all of the interfaces according to its own requirements, so that the service module may have the capability of sensing corresponding events after registering in the framework core module. Certainly, for the framework kernel, the interface for sensing the system event may be provided by encapsulating the system interface, that is, the framework kernel performs a layer of encapsulation on the basis of the system interface, so that the service module in the application program does not need to directly call the system interface to sense the event, but can sense the event by implementing the interface provided by the framework kernel.
For example, a certain business module is an order module, and the function of the module is to provide the generated order list information, which includes information such as the status of each order. After the application program switches from the background state to the foreground state, the latest order information generally needs to be obtained from the server again so as to update the order list information. Therefore, the order module can implement a sensing interface for sensing an event about to enter an active state, so that, after the order module is registered, if an event occurs that the application program switches from a background to a foreground, the order module can sense the event and further perform corresponding processing on the event (specific processing operations will be described later).
In practical applications, the system events within the application lifecycle are very limited and often insufficient to meet the various requirements of a particular business module. For this reason, in the embodiment of the present application, the framework core module may further provide a generic event aware interface, where a generic event refers to an event that is extended based on a system event and is shared among the service modules, that is, all the service modules may have a requirement for sensing the event, but the event is not a system event and is therefore referred to as a generic event.
The general events may specifically include some notification events provided by the system, for example, a system memory shortage (DidReceiveMemoryWarning) event, a system time change (signifieattimechange) event, a status bar direction to-be-changed (willChangeStatusBarFrame) event, a status bar direction to-be-changed (didchanging status barorientation), a URL initiation (handleOpenURL) event, and the like. Such generic events are typically used for the service module to sense during the start-up or initialization process and to perform relevant processing on the corresponding events. For example, referring to fig. 3, compared to the conventional startup state in fig. 2, during the lifecycle of the application program, in the startup phase of the application program, the states of module setting (modSetup), module initialization (modInit), and window hooking (modSplash) may also be included.
For example, assuming that the application program in the embodiment of the present application is a, the user enters the application program a by means of a link or the like during using another application program B, and so on. For this case, some service modules may need to perform some special processing. For example, the payment module may need to perform a settlement operation based on parameters passed in by application B, and so on. In this case, the payment module may sense the special starting manner of the application by implementing the "start-by-URL" event-aware interface, acquire the incoming parameters, and then perform the related processing.
In addition, if neither the system event nor the general event is enough to meet the actual requirements of the service module, in the embodiment of the present application, the framework core module may also provide a custom event aware interface. The so-called custom event refers to an event that a service module can define according to its own special requirements. For example, the application may be launched from a search system, such as, for example, assuming that a user clicked a link from search results during a keyword search using a search engine, jumped to the application "Tianmao" via the link, and so on. For this starting mode from the search engine, a certain service module needs to perform some special processing, and so on. The event of 'starting from the search engine' does not belong to a system event or a general event, so that the service module can realize the perception of the event in a self-defined mode.
In a specific implementation, the framework core module may further provide an interface for event extension, for example, referred to as bhappldelete, and the service module may extend its own event by inheriting the bhapplegate, so that the system core may sense the custom event. In addition, each module entry class can be accessed through the ModulesByName in the context to increase the trigger point. The context information may include a list of modulesbynames, all registered module resources can be found through the list, one module resource may expose some attributes to other module resources for use, for example, the login module needs to know whether the configuration module is loaded and returns to a specified login configuration, and then the login module can directly know the state of the configuration module in the login module through the manner. For another example, when the service module is a download page and executes a corresponding custom operation, and when the page is downloaded, the bhappdelete helps the BHApplication to complete a didfinishlackingwithoptions action, and accordingly, the corresponding custom operation is executed in the method. BHapplication delegates BHAppedegrate, which implements a defined protocol (BHModuleProtocol).
The service module 1022 is configured to perform event awareness through an event awareness interface of the framework core module, and initiate a call request to a service interface corresponding to a target event when the target event is perceived;
the service module senses the occurrence of specific events by implementing an event sensing interface provided by the framework core module, wherein the specific events comprise system events, general events, custom events and the like. After a specific event is sensed, if a specific processing operation needs to be executed, the operation can be realized by calling a corresponding service interface. The specific service interface to be called after a certain event is sensed may be defined in the service module in advance, that is, for a developer, which basic function modules exist in the system and which service interfaces each function module corresponds to are known, so that event sensing may be used as a trigger condition for calling the specific service interface.
For example, in the foregoing example, the order module may call the service interface of the issuing configuration module when sensing an event that the application program switches from background to foreground for execution, because the information issuing function of the issuing configuration module needs to be used. As another example, the payment module may call a service interface of the settlement module upon sensing an event initiated from another application, because a settlement function using a settlement result is required, and so on. The service module may carry some parameters in the request when calling the service interface, for example, when calling the service interface of the issuing configuration module, parameters such as contents to be issued may be carried, so that the service interface may transmit the information to the issuing configuration module, and thus, the issuing configuration module may know what contents need to be issued.
It should be noted that, in some scenarios, when a business module accesses each object declared as a service interface, if it is desired that the service interface object can retain some state, the service interface object may be declared as a singleton object.
Of course, before the service interface is called, the service module may first determine whether the corresponding service interface is registered according to context information provided by the framework core module, and if the service interface is registered, the service interface may be called, and if the service interface is not registered, the service interface may not initiate the call because the service interface does not conform to the framework protocol. In addition, in the process of running the application program, if the service module needs to acquire information such as the running environment and configuration parameters of the application program, the information can also be acquired from the context information provided by the frame core module.
The service interface 103 is configured to call a corresponding basic function module after receiving a call request of a service module, transfer a parameter in the call request to the basic function module, and return a processing result to the service module after receiving the processing result returned by the basic function module;
the service interface is corresponding to the basic function module, and can provide various different service interfaces according to different calling modes of the basic function module, and can be called by the service module after being registered to the frame core module. When receiving a call request, the service interface can initiate a call to the corresponding basic function module according to the call mode corresponding to the service interface, and transmit the parameters carried in the call request of the service module to the basic function module, so that the basic function module can perform corresponding processing and return the processing result to the service interface, and after receiving the processing result, the service interface returns the processing result to the service module.
That is to say, the service module can realize indirect calling of the basic function module through the service interface, the service module does not need to care about specific implementation inside the basic function module, even if the code of the basic function module is updated, even if the whole basic function module is updated, the service module can not sense, and does not need to modify the related calling code, so that the multiplexing cost of the code of the basic function module among different service modules is controlled.
The basic function module 1021 is configured to execute corresponding processing according to the parameter transmitted by the service interface, and return a processing result to the service interface.
As described above, the basic function module is mainly configured to execute corresponding processing after receiving the parameters sent by the service interface, and return the processing result to the service interface, so that the service interface returns the processing result to the service module.
In short, in the embodiment of the present application, an application framework may be provided, context information in the application may be provided for each module through a framework core module, and the framework core module and the service module may interact through an event-aware interface, so that the service module may sense various events through the event-aware interface of the framework core module. After the event is sensed, if the function of the basic function module needs to be used, the indirect calling of the basic function module can be realized through the service interface corresponding to the basic function module, so that the service module and the basic function module do not have strong association any more, the coupling degree between the service module and the basic function module is reduced, and the multiplexing cost can be reduced in the process of multiplexing the basic function module codes by different service modules. In addition, since the plug-in management of each module can be realized, the modules can be added or deleted without affecting other modules, and the flexibility of the modules is improved.
Example two
In the second embodiment, an inter-module calling method in an application program is provided from the perspective of a frame core module, and it should be noted that, first, the application program includes: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface;
referring to fig. 4, the method may include the steps of:
s401: the framework core module maintains context information related to the application program and provides an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
s402: when a target event is sensed, providing the target event information to a registered service module of an event sensing interface for realizing the target event, so that the service module initiates a calling request to a service interface corresponding to the target event after sensing the target event, the service interface calls a corresponding basic function module, transmits parameters in the calling request to the basic function module, and returns a processing result to the service module after receiving the processing result returned by the basic function module.
EXAMPLE III
In the third embodiment, from the perspective of a service module, there is provided an inter-module calling method in an application program, and it should be noted that, first, the application program includes: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface; the framework core module is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
referring to fig. 5, the method may include the steps of:
s501: the service module carries out event perception by realizing an event perception interface of the framework core module;
s502: when a target event is sensed, judging whether a service interface corresponding to the target event is registered or not according to the context information;
s503: if the service interface is registered, a calling request is sent to the service interface so that the service interface can call the corresponding basic function module, parameters in the calling request are transmitted to the basic function module, and after a processing result returned by the basic function module is received, the processing result is returned to the service module.
Example four
Fourth, the embodiment provides an inter-module calling method in an application program from the perspective of a business module, and also the application program may include: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface; the framework core module is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
referring to fig. 6, the method may specifically include:
s601: the service interface receives a calling request of the service module and judges whether the corresponding basic function module is registered according to the context information;
s602: if the basic function module is registered, the basic function module is called, parameters in a calling request are transmitted to the basic function module, and after a processing result returned by the basic function module is received, the processing result is returned to the service module.
It should be noted that, for specific implementation manners of the steps in the second to fourth embodiments, reference may be made to the description in the first embodiment, and details are not described here.
Corresponding to the second embodiment, the embodiment of the present application further provides an inter-module calling apparatus in an application program, where the application program includes: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface;
referring to fig. 7, the apparatus is applied to a frame core module, and includes:
a context information maintaining unit 701, configured to maintain context information related to an application program, and provide an event-aware interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
an interaction unit 702, configured to provide, when a target event is sensed, target event information to a registered service module of an event sensing interface that implements the target event, so that the service module initiates a call request to a service interface corresponding to the target event after sensing the target event, the service interface calls a corresponding basic function module, and transmits a parameter in the call request to the basic function module, and after receiving a processing result returned by the basic function module, returns the processing result to the service module.
Corresponding to the three phases of the embodiment, the embodiment of the application further provides an inter-module calling device in an application program, and the application program includes: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface; the framework core module is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
referring to fig. 8, the apparatus is applied to a service module, and includes:
an event awareness unit 801, configured to perform event awareness by implementing an event awareness interface of the framework core module;
a determining unit 802, configured to determine, when a target event is sensed, whether a service interface corresponding to the target event is registered according to the context information;
a calling unit 803, configured to initiate a call request to the service interface if the service interface is registered, so that the service interface calls the corresponding basic function module, transfer a parameter in the call request to the basic function module, and return a processing result to the service module after receiving the processing result returned by the basic function module.
Corresponding to the fourth embodiment, an embodiment of the present application further provides an inter-module calling apparatus in an application program, where the application program includes: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface; the framework core module is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
referring to fig. 9, the apparatus is applied to a service interface, and includes:
a call request receiving unit 901, configured to receive a call request of a service module, and determine whether a corresponding basic function module is registered according to the context information;
a calling unit 902, configured to call the basic function module if the basic function module is registered, transfer a parameter in the call request to the basic function module, and return a processing result to the service module after receiving the processing result returned by the basic function module.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present application may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments of the present application.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the system or system embodiments are substantially similar to the method embodiments and therefore are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described system and system embodiments are only illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The method, the device and the system for calling among modules in the application program provided by the application program are introduced in detail, a specific example is applied in the description to explain the principle and the implementation manner of the application program, and the description of the embodiment is only used for helping to understand the method and the core idea of the application program; meanwhile, for a person skilled in the art, according to the idea of the present application, the specific embodiments and the application range may be changed. In view of the above, the description should not be taken as limiting the application.

Claims (13)

1. An inter-module call system in an application, the system comprising: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface; wherein:
the framework core module is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
the service module is used for sensing an event through an event sensing interface of the frame core module, and initiating a calling request to a service interface corresponding to a target event when the target event is sensed;
the service interface is used for calling the corresponding basic function module according to the calling request of the service module, transmitting the parameters in the calling request to the basic function module, and returning the processing result to the service module after receiving the processing result returned by the basic function module;
the basic function module is used for executing corresponding processing according to the parameters transmitted by the service interface and returning a processing result to the service interface;
the framework core module is further used for providing an interface for event extension, and the service module is further used for realizing a custom event perception interface by inheriting the interface for event extension so as to perceive a custom event.
2. The system of claim 1, wherein the framework core module is further configured to perform registration management for module resources and service interfaces.
3. The system of claim 2, wherein the framework core module performs registration management for other modules by: and performing static registration on the module resources or the service interfaces according to the module or service identifiers recorded in the static registration file inside the framework core module.
4. The system of claim 2, wherein the framework core module performs registration management for other modules by: when module resources or service interfaces are initialized, a registration request is initiated by calling a registration interface of the framework core module, and the framework core module dynamically registers the corresponding module resources or service interfaces according to the received registration request.
5. The system of claim 1, wherein the event-aware interface comprises a system event-aware interface, the system event comprising a lifecycle event of an application.
6. The system of claim 1, wherein the event aware interface comprises a generic event aware interface, and the generic event comprises an event extended based on a system event and is shared among the service modules, so that each service module is aware of the occurrence of the generic event during a start-up or initialization process.
7. The system according to claim 1, wherein the basic function module provides some or all of the attributes to other basic function modules externally, so that the other basic function modules can know the corresponding status information of the basic function module.
8. A method for calling between modules in an application program is characterized in that:
the application program comprises: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface;
the method comprises the following steps:
the framework core module maintains context information related to the application program and provides an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
when a target event is sensed, providing the target event information to a registered service module of an event sensing interface for realizing the target event, so that the service module initiates a calling request to a service interface corresponding to the target event after sensing the target event, the service interface calls a corresponding basic function module, transmits parameters in the calling request to the basic function module, and returns a processing result to the service module after receiving the processing result returned by the basic function module.
9. A method for calling between modules in an application program is characterized in that:
the application program comprises: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface; the framework core module is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
the method comprises the following steps:
the service module carries out event perception by realizing an event perception interface of the framework core module;
when a target event is sensed, judging whether a service interface corresponding to the target event is registered or not according to the context information;
if the service interface is registered, a calling request is sent to the service interface so that the service interface can call the corresponding basic function module, parameters in the calling request are transmitted to the basic function module, and after a processing result returned by the basic function module is received, the processing result is returned to the service module.
10. A method for calling between modules in an application program is characterized in that:
the application program comprises: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface; the framework core module is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
the method comprises the following steps:
the service interface receives a calling request of the service module and judges whether the corresponding basic function module is registered according to the context information;
if the basic function module is registered, the basic function module is called, parameters in a calling request are transmitted to the basic function module, and after a processing result returned by the basic function module is received, the processing result is returned to the service module.
11. An inter-module calling apparatus in an application program, characterized in that:
the application program comprises: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface;
the device is applied to a frame core module and comprises:
the context information maintenance unit is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
and the interaction unit is used for providing the target event information to a registered service module of an event perception interface realizing the target event when the target event is perceived, so that the service module initiates a calling request to a service interface corresponding to the target event after perceiving the target event, the service interface calls a corresponding basic function module, parameters in the calling request are transmitted to the basic function module, and after a processing result returned by the basic function module is received, the processing result is returned to the service module.
12. An inter-module calling apparatus in an application program, characterized in that:
the application program comprises: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface; the framework core module is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
the device is applied to a business module and comprises:
the event perception unit is used for perceiving events through an event perception interface which realizes the framework core module;
the judging unit is used for judging whether a service interface corresponding to the target event is registered or not according to the context information when the target event is sensed;
and the calling unit is used for initiating a calling request to the service interface if the service interface is registered so that the service interface can call the corresponding basic function module, transmitting the parameters in the calling request to the basic function module, and returning the processing result to the service module after receiving the processing result returned by the basic function module.
13. An inter-module calling apparatus in an application program, characterized in that:
the application program comprises: the system comprises a framework core module, module resources and a service interface, wherein the module resources comprise a basic function module and a business module, and the basic function module corresponds to the service interface; the framework core module is used for maintaining context information related to the application program and providing an event perception interface; the context information comprises running environment information and configuration parameter information of the application program and registration information of the module resources and the service interfaces, and the context information is used for sharing among the module resources;
the device is applied to a service interface and comprises:
a call request receiving unit, configured to receive a call request of a service module, and determine whether a corresponding basic function module is registered according to the context information;
and the calling unit is used for calling the basic function module if the basic function module is registered, transmitting parameters in the calling request to the basic function module, and returning a processing result to the service module after receiving the processing result returned by the basic function module.
CN201610154054.2A 2016-03-17 2016-03-17 Method, device and system for calling among modules in application program Active CN107203419B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610154054.2A CN107203419B (en) 2016-03-17 2016-03-17 Method, device and system for calling among modules in application program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610154054.2A CN107203419B (en) 2016-03-17 2016-03-17 Method, device and system for calling among modules in application program

Publications (2)

Publication Number Publication Date
CN107203419A CN107203419A (en) 2017-09-26
CN107203419B true CN107203419B (en) 2021-03-02

Family

ID=59904132

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610154054.2A Active CN107203419B (en) 2016-03-17 2016-03-17 Method, device and system for calling among modules in application program

Country Status (1)

Country Link
CN (1) CN107203419B (en)

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108108170B (en) * 2018-01-04 2021-04-27 武汉斗鱼网络科技有限公司 Decoupling method and system of assembly
CN108363614B (en) * 2018-03-07 2022-04-12 北京恒华伟业科技股份有限公司 Application service module management method and device and server
CN110347371A (en) * 2018-04-03 2019-10-18 北京京东尚科信息技术有限公司 A kind of method and apparatus of intermodule communication
CN109032815A (en) * 2018-07-18 2018-12-18 武汉斗鱼网络科技有限公司 Information interacting method, device, equipment and storage medium between functional module
CN109388401B (en) * 2018-08-24 2022-02-01 创新先进技术有限公司 Service distribution method and system
CN109343982A (en) * 2018-09-30 2019-02-15 武汉斗鱼网络科技有限公司 Information interacting method, device, equipment and storage medium between functional module
CN109343983B (en) * 2018-09-30 2021-07-23 武汉斗鱼网络科技有限公司 Information interaction method, device, equipment and storage medium between function modules
CN111262897B (en) * 2018-12-01 2022-06-14 阿里巴巴集团控股有限公司 Service call routing processing method, device and system
CN111258772B (en) * 2018-12-01 2022-08-09 阿里巴巴集团控股有限公司 Service calling information processing method, device and system
CN109739661B (en) * 2018-12-27 2021-06-22 思必驰科技股份有限公司 Method, device and system for updating messages between collaborative modules
CN109800549A (en) * 2018-12-29 2019-05-24 北京奇安信科技有限公司 A kind of login process method and device based on general login module
CN110096351A (en) * 2019-04-12 2019-08-06 平安普惠企业管理有限公司 The method and device of cross-system calling workflow
CN111131414B (en) * 2019-12-11 2022-05-24 拉扎斯网络科技(上海)有限公司 Back-end platform, service calling method, first service module and server
CN111221512B (en) * 2020-01-03 2023-12-05 杭州涂鸦信息技术有限公司 Function module mixed use method, electronic device and storage medium
CN111245918A (en) * 2020-01-07 2020-06-05 微民保险代理有限公司 Service request transmission method and device
CN111339533B (en) * 2020-02-14 2023-04-28 北京工业大学 Application layer-oriented trusted cryptographic module interface design method
CN111414152B (en) * 2020-03-25 2023-04-21 北京字节跳动网络技术有限公司 Method, system, readable medium and electronic device for realizing business logic

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101645013A (en) * 2009-09-07 2010-02-10 中兴通讯股份有限公司 Plug-in type service management system and method of integrated service management platform
CN103164239A (en) * 2012-12-11 2013-06-19 广东电网公司电力科学研究院 Plug-in implement method based on micro network visual platform
CN105260246A (en) * 2015-11-10 2016-01-20 中国建设银行股份有限公司 Method and device for calling application system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101645013A (en) * 2009-09-07 2010-02-10 中兴通讯股份有限公司 Plug-in type service management system and method of integrated service management platform
CN103164239A (en) * 2012-12-11 2013-06-19 广东电网公司电力科学研究院 Plug-in implement method based on micro network visual platform
CN105260246A (en) * 2015-11-10 2016-01-20 中国建设银行股份有限公司 Method and device for calling application system

Also Published As

Publication number Publication date
CN107203419A (en) 2017-09-26

Similar Documents

Publication Publication Date Title
CN107203419B (en) Method, device and system for calling among modules in application program
CN109547570B (en) Service registration method, device, registration center management equipment and storage medium
CN107391114B (en) Page visual rendering method and device
US10382257B2 (en) Microservices communication pattern for fault detection in end-to-end flows
CN111726399B (en) Docker container secure access method and device
CN109976667B (en) Mirror image management method, device and system
CN113296798B (en) Service deployment method, device and readable storage medium
CN111857733B (en) Construction method, device and system of service environment and readable storage medium
CN110968331A (en) Method and device for running application program
RU2580079C2 (en) Application activation framework
US9760472B2 (en) Tenant code debugging in multi-tenant systems
CN114079653B (en) Communication method, device, computer equipment and storage medium
CN109343970B (en) Application program-based operation method and device, electronic equipment and computer medium
CN114547569A (en) Account login processing method and device
CN114281555A (en) Application state synchronization method and device, electronic equipment and storage medium
US11071151B2 (en) Methods and apparatuses for connecting a wireless access point through an application in a user equipment
US10997269B1 (en) Using web application components with different web application frameworks in a web application
CN111722850B (en) Processing method, device and system for multi-system application
CN109445960B (en) Application routing method, device and storage medium
CN114726905B (en) Method, device, equipment and storage medium for accessing Tbox network into Android system
CN114090183B (en) Application starting method and device, computer equipment and storage medium
CN115629809A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN107783837B (en) Method and device for performing storage expansion and electronic equipment
CN108804236B (en) AIDL file sharing method and system
CN106570143B (en) Method and device for sending response object

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant