CN114385174A - Compiling method, device, equipment and storage medium of functional module - Google Patents

Compiling method, device, equipment and storage medium of functional module Download PDF

Info

Publication number
CN114385174A
CN114385174A CN202011118344.4A CN202011118344A CN114385174A CN 114385174 A CN114385174 A CN 114385174A CN 202011118344 A CN202011118344 A CN 202011118344A CN 114385174 A CN114385174 A CN 114385174A
Authority
CN
China
Prior art keywords
function
module
submodule
sub
description
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.)
Pending
Application number
CN202011118344.4A
Other languages
Chinese (zh)
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.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co 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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN202011118344.4A priority Critical patent/CN114385174A/en
Publication of CN114385174A publication Critical patent/CN114385174A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/433Dependency analysis; Data or control flow analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/35Creation or generation of source code model driven
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention discloses a compiling method, a compiling device, equipment and a storage medium of a functional module, wherein the method comprises the following steps: acquiring function description sub-modules in a second function module which is depended by a first function module, wherein each function module comprises a function description sub-module and a function realization sub-module, and the function description sub-modules are used for describing function information of function functions exposed by the function modules; the function realization submodule is used for realizing the specific logic of the functional function exposed by the functional module; compiling the function description sub-modules in the first function module and the second function module, and adding the compiling result of the function description sub-module in the second function module to the compiling result of the first function module. By the technical scheme of the embodiment of the invention, the compiling efficiency can be improved.

Description

Compiling method, device, equipment and storage medium of functional module
Technical Field
The present invention relates to computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for compiling a functional module.
Background
In order to improve the development efficiency of the application software, software development is generally performed in a functional modularization manner, that is, each function in the application software is divided into corresponding functional modules for software development. For example, a functional module responsible for user login is used as a login module; and the function module for receiving, analyzing, sending and the like the bullet screen message is used as a bullet screen module and the like.
At present, functional modules in application software developed based on the Android system often need to directly depend on other related functional modules during working so that functions of the dependent functional modules can be used. Because of the direct dependency relationship between the functional modules, when a functional module is compiled, the compiling results of the functional modules which depend on the functional module need to be completely copied into the compiling result of the functional module, so that the problem of repeatedly copying a large number of files exists, and the compiling efficiency is greatly reduced.
Disclosure of Invention
The embodiment of the invention provides a compiling method, a compiling device, compiling equipment and a storage medium of a functional module, and aims to improve compiling efficiency.
In a first aspect, an embodiment of the present invention provides a method for compiling a functional module, including:
acquiring function description sub-modules in a second function module which is depended by a first function module, wherein each function module comprises a function description sub-module and a function realization sub-module, and the function description sub-modules are used for describing function information of function functions exposed by the function modules; the function realization sub-module is used for realizing the specific logic of the function exposed by the function module;
compiling function description sub-modules in the first function module and the second function module, and adding a compiling result of the function description sub-module in the second function module to a compiling result of the first function module;
and the first functional module acquires a function implementation object corresponding to the function implementation submodule in the second functional module according to the function description submodule depended on, and calls a functional function in the second functional module based on the function implementation object.
In a second aspect, an embodiment of the present invention further provides a compiling apparatus for a functional module, including:
the function description submodule acquisition unit is used for acquiring function description submodules in second function modules depended by the first function modules, wherein each function module comprises a function description submodule and a function realization submodule, and the function description submodule is used for describing function information of the function functions exposed by the function modules; the function realization sub-module is used for realizing the specific logic of the function exposed by the function module;
the compiling unit is used for compiling the function description sub-modules in the first function module and the second function module and adding the compiling result of the function description sub-module in the second function module to the compiling result of the first function module;
and the first functional module acquires a function implementation object corresponding to the function implementation submodule in the second functional module according to the function description submodule depended on, and calls a functional function in the second functional module based on the function implementation object.
In a third aspect, an embodiment of the present invention further provides an apparatus, where the apparatus includes:
one or more processors;
a memory for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors implement the compiling method of the functional module as provided by any of the embodiments of the present invention.
In a fourth aspect, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements a compiling method for the functional module provided in any embodiment of the present invention.
In the embodiment of the invention, each functional module is divided into a functional description submodule and a functional realization submodule in advance, wherein the functional description submodule is used for describing the function information of the functional function exposed by the functional module; the function realization submodule is used for realizing the specific logic of the functional function exposed by the functional module. The function description submodule is very small because the function description submodule does not relate to the specific implementation logic of the function. When the first functional module depends on the second functional module, only the function description sub-module in the second functional module can be relied on, and the function realization sub-module in the second functional module is not relied on, so that when compiling, only the compiling result of the function description sub-module in the second functional module can be added into the compiling result of the first functional module to complete the compiling operation of the first functional module, and the compiling result of the function realization sub-module in the second functional module does not need to be added, thereby greatly reducing the file copy number and improving the compiling efficiency. Moreover, the first functional module may obtain the function implementation object corresponding to the function implementation sub-module in the second functional module according to the dependent function description sub-module, and may call the function in the second functional module based on the function implementation object, thereby improving the compiling efficiency and ensuring that the original function of the functional module remains unchanged.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief description will be given below of the drawings required for the embodiments or the technical solutions in the prior art, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a flowchart illustrating a method for compiling a functional module according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a method for compiling a functional module according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a functional module compiling apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart illustrating a method for compiling a functional module according to an embodiment of the present invention, which is applicable to compiling a functional module in application software. The method can be executed by a compiling device of the functional module, the device can be realized by software and/or hardware, and the device is integrated in equipment with an Android system, such as an intelligent terminal such as a smart phone, a tablet computer, a smart television or a notebook computer. The method specifically comprises the following steps:
s110, acquiring function description sub-modules in a second function module depended by a first function module, wherein each function module comprises a function description sub-module and a function realization sub-module, and the function description sub-modules are used for describing function information of function functions exposed by the function modules; the function realization submodule is used for realizing the specific logic of the functional function exposed by the functional module.
The functional module may be a source program code written in advance by a developer and used for implementing a specific function. The function description submodule in the functional module can be used for describing function information of the functional function exposed by the functional module to other functional modules, and does not relate to specific implementation logic of the functional function. That is, each function in the function description submodule is a null function. The function may refer to a protocol method for implementing a required function in a function module protocol, and may be set based on a service requirement. The number of function functions in each function module may be one or more. For example, when the function module is a user module, the function in the user module may include, but is not limited to: a user name acquisition function getUserName () and a user password acquisition function getUserToken. The function information of the function may include, but is not limited to: function name of function, input parameter type, return parameter type, and function modifier. The function implementation submodule in the functional module may be configured to implement specific logic of each functional function described by the function description submodule. For example, each function in the function implementation submodule contains a corresponding function implementation code block inside, so that the corresponding function can be implemented by calling the function.
The first functional module may refer to any functional module to be compiled currently. The second function module may refer to a function module that needs to be introduced in the first function mode so that the first function module can use the function of the second function module. The second functional module may be one or more.
Specifically, in the prior art, the content of one functional module is usually set inside the functional module, so as to achieve the effect of low coupling and high cohesion of the functional module, but such setting may result in direct dependency between the functional modules, for example, the functional module a may directly depend on the function implementation logic of the functional module B, thereby resulting in a great reduction in compiling efficiency. In this embodiment, each functional module is isolated and split once in advance, and each functional module is split into a function description submodule and a function implementation submodule. Because the function description submodule is only used for describing function information of the function in the function module and does not relate to specific implementation logic of the function, files contained in the function description submodule are very few, namely the function description submodule is very small. When the first functional module needs to introduce the second functional module, the dependence can be transferred, namely, the first functional module depends on the functional description sub-module with very small occupied space in the second functional module, and does not need to depend on the function realization sub-module with larger occupied space in the second functional module, thereby avoiding the direct dependence between the functional modules.
It should be noted that, the first functional module obtains a function implementation object corresponding to the function implementation sub-module in the second functional module according to the dependent function description sub-module, and calls a function in the second functional module based on the function implementation object. The function implementation object may refer to an object created in advance in the function module and used for implementing a function of the module.
Specifically, the first functional module may obtain, based on a mapping relationship between a preset function description submodule and a function implementation object corresponding to the function implementation submodule, a function implementation object corresponding to the function implementation submodule in the second functional module according to the function description submodule in the second functional module that depends on the first functional module, and may enable the first functional module to use a function of the second functional module by calling a function included in the function implementation object. For example, when the module a needs to introduce a login function, the module a may rely on a login function description submodule in the login module, obtain a login function implementation object corresponding to the login implementation submodule based on the relied login function description submodule, and implement a login function in the object by calling the login function, so that the module a may have the login function, and thus, when the function modules indirectly depend on each other, it may be ensured that the original functions of the function modules remain unchanged.
And S120, compiling the function description sub-modules in the first function module and the second function module, and adding the compiling result of the function description sub-module in the second function module to the compiling result of the first function module.
Specifically, the source program corresponding to the first functional module and the source program corresponding to the functional description submodule in the second functional module may be compiled respectively and converted into a compiler program recognizable by the computer, so as to obtain a compiling result of the first functional module and a compiling result of the functional description submodule in the second functional module. Because the first functional module only depends on the function description submodule in the second functional module, the compiling result of the function description submodule in the second functional module can be only copied to the compiling result of the first functional module, and the compiling operation of the first functional module is completed. Because the function description submodule is very small, corresponding compiled files are also very few, thereby greatly reducing the file copy number and improving the compiling efficiency. Moreover, the compiling efficiency can be improved under the condition of ensuring that the original functions of the functional modules are not changed.
In the technical scheme of the embodiment, each functional module is divided into a function description submodule and a function realization submodule in advance, wherein the function description submodule is used for describing function information of a functional function exposed by the functional module; the function realization submodule is used for realizing the specific logic of the functional function exposed by the functional module. The function description submodule is very small because the function description submodule does not relate to the specific implementation logic of the function. When the first functional module depends on the second functional module, only the function description sub-module in the second functional module can be relied on, and the function realization sub-module in the second functional module is not relied on, so that when compiling, only the compiling result of the function description sub-module in the second functional module can be added into the compiling result of the first functional module to complete the compiling operation of the first functional module, and the compiling result of the function realization sub-module in the second functional module does not need to be added, thereby greatly reducing the file copy number and improving the compiling efficiency. Moreover, the first functional module may obtain the function implementation object corresponding to the function implementation sub-module in the second functional module according to the dependent function description sub-module, and may call the function in the second functional module based on the function implementation object, thereby improving the compiling efficiency and ensuring that the original function of the functional module remains unchanged.
Example two
Fig. 2 is a flowchart of a compiling method of a functional module according to a second embodiment of the present invention, where on the basis of the foregoing embodiment, before acquiring a function description submodule in a second functional module that a first functional module depends on, the present embodiment further includes: creating a function description submodule in each functional module; and establishing association between the function description sub-module and the function realization sub-module to be established, and establishing the corresponding function realization sub-module based on the association. Wherein explanations of the same or corresponding terms as those of the above-described embodiments are omitted.
Referring to fig. 2, the method for compiling a functional module provided in this embodiment specifically includes the following steps:
and S210, creating a function description submodule in each functional module.
Specifically, for each functional module, a functional description protocol may be defined, and a functional function that is not implemented by the function may be defined in the functional description protocol to describe the function information of each functional function exposed by the functional module, so as to create a functional description submodule.
Illustratively, S210 may include: the function description protocol in the function module inherits the keyword through the calling interface, inherits the preset basic protocol, and describes the function information of the exposed function in the inherited function description protocol so as to obtain the function description submodule in the function module.
The preset basic protocol can be a preset null protocol, so that the protocol can be uniformly expanded, and the protocol management is facilitated. Illustratively, the predetermined base protocol IBaseRouter may be defined as follows:
Public interface IBaseRouter{
}
specifically, the function description protocol in the function module may inherit the preset base protocol by calling an interface to inherit the keyword instance, and define each function that is not implemented by the function in the inherited function description protocol, thereby obtaining the function description submodule for describing the function information of the function.
Exemplarily, when the function module is a user module, the IUserRouter function in the user module may be defined as follows:
Figure BDA0002731132330000091
it should be noted that, the two function functions getUserName () and getUserToken defined in the IUserRouter are both used to describe function information of the function, and do not relate to a specific function implementation logic.
S220, establishing the association between the function description sub-module and the function realization sub-module to be established, and establishing the corresponding function realization sub-module based on the association.
Specifically, the association between the function realization sub-module in the function module and the function description sub-module in the function module may be established in the function realization sub-module in the function module, so as to obtain the function description protocol in the function description sub-module based on the association, and perform function time on the function in the function description protocol, thereby creating the corresponding function realization sub-module.
Exemplarily, the establishing of the association between the function description submodule and the function implementation submodule to be created in S220 may include: naming the function description sub-module based on a preset naming mode; and establishing the association between the function description submodule and the function realization submodule to be created according to the module name of the function description submodule.
Specifically, the function description submodule and the function implementation submodule may be named based on a preset naming mode in the embodiment, so that convenient management may be performed in a name mode. Illustratively, the preset naming mode may be: the module name format of the function description submodule is as follows: XXXAPI, the module name format of the function implementation sub-module is: ModuleXXXX. For example, the function description sub-module in the user module is named: the UserAPI, function implementation sub-module is named as: and the ModuleUser can quickly acquire the relation between the function description submodule and the function realization submodule based on the module name. The association of the function description submodule can be introduced in the function implementation submodule to be created by calling the build (xxxipi), so as to establish the association between the function description submodule and the function implementation submodule to be created.
Illustratively, the "creating a corresponding function implementation sub-module based on association" in S220 may include: based on the association, acquiring a function description protocol in the associated function description submodule; the function implementation class in the function module inherits the keywords through a calling interface, inherits the acquired function description protocol, duplicates each function in the function description protocol, and writes specific implementation logic of each function so as to obtain a corresponding function implementation sub-module.
Specifically, by introducing the association into the function implementation sub-module to be created, the function implementation sub-module can obtain the function description protocol in the associated function description sub-module. The function module can be configured with a function realization class in advance, so that the function realization class can inherit the acquired function description protocol by calling an interface to inherit the keyword instance, and rewrite each function in the function description protocol in the function realization class, and write a corresponding function realization code block for each function, so that each function in the function realization class can realize a corresponding function, thereby creating a corresponding function realization submodule.
Illustratively, the function implementation class userroutermipl in the user module may be defined as follows:
Figure BDA0002731132330000101
and S230, acquiring a function description submodule in a second functional module depended by the first functional module.
S240, compiling the function description sub-modules in the first function module and the second function module, and adding the compiling result of the function description sub-module in the second function module to the compiling result of the first function module.
According to the technical scheme of the embodiment, the corresponding function description sub-module is established for each function module, the association between the function description sub-module and the function realization sub-module to be established is established, and the corresponding function realization sub-module can be established based on the association, so that the establishment of the function description sub-module and the function realization sub-module in each function module is realized, the isolation and the splitting of the function modules are realized, the direct dependence between the function modules is avoided, and the compiling efficiency is improved conveniently.
On the basis of the above technical solution, the method may further include: instantiating the function implementation class in the function implementation sub-module to obtain a corresponding function implementation object; and storing the function description protocol and the function realization object into a preset memory in a key value pair mode.
Specifically, by instantiating the function implementation class in the function implementation sub-module, a corresponding function implementation object may be created, so that the function that has completed the function implementation may be called by using the function implementation object in the following, and a corresponding function may be implemented. After the function implementation object is obtained, the function implementation object and the function description protocol need to be stored in the preset memory in a key-value pair manner, so that other subsequent function modules can query the preset memory to obtain the function implementation object. For example, the function description protocol and the function implementation object may be stored in a preset memory cache in a key value pair manner by calling router ("IUserRouter," this "), where IUserRouter refers to a function description protocol in the user module, and this refers to an instance object of a user routerimpl function implementation class in the user module, that is, a function implementation object, so as to perform information query subsequently.
For example, the obtaining, by the first functional module, the function implementation object corresponding to the function implementation sub-module in the second functional module according to the dependent function description sub-module may include: acquiring a target function description protocol in the dependent function description submodule; and inquiring a target function realization object corresponding to the target function description protocol from a preset memory according to the target function description protocol, wherein the target function realization object is used as a function realization object corresponding to a function realization submodule in the second function module.
The target function description protocol may refer to a function description protocol in a function description submodule in a second function module on which the first function module depends.
Specifically, the first functional module may obtain the target function description protocol in the dependent function description submodule based on the function description submodule in the dependent second functional module. The target function description protocol may be used as key information based on each key value pair information stored in the preset memory, and the value information corresponding to the key information may be queried from the preset memory, thereby obtaining the target function implementation object. The first functional module realizes the function in the object by calling the target function, and can introduce the function of the second functional module, thereby improving the compiling efficiency and ensuring that the original function of the functional module is kept unchanged.
The following is an embodiment of a compiling apparatus for functional modules according to an embodiment of the present invention, which belongs to the same inventive concept as the compiling method for functional modules according to the above embodiments, and details that are not described in detail in the embodiment of the compiling apparatus for functional modules may refer to the embodiment of the compiling method for functional modules.
EXAMPLE III
Fig. 3 is a schematic structural diagram of a functional module compiling apparatus according to a third embodiment of the present invention, where this embodiment is applicable to detecting whether a ring dependency exists when at least two functional modules are initialized in application software, and the apparatus specifically includes: a function description submodule acquisition unit 310 and a compiling unit 320.
The function description submodule obtaining unit 310 is configured to obtain a function description submodule in a second function module that the first function module depends on, where each function module includes a function description submodule and a function implementation submodule, and the function description submodule is used to describe function information of a function exposed by the function module; the function realization sub-module is used for realizing the specific logic of the function exposed by the function module; a compiling unit 320, configured to compile function description sub-modules in the first functional module and the second functional module, and add a compiling result of the function description sub-module in the second functional module to a compiling result of the first functional module; and the first functional module acquires a function implementation object corresponding to the function implementation submodule in the second functional module according to the function description submodule depended on, and calls a functional function in the second functional module based on the function implementation object.
In the technical scheme of the embodiment, each functional module is divided into a function description submodule and a function realization submodule in advance, wherein the function description submodule is used for describing function information of a functional function exposed by the functional module; the function realization submodule is used for realizing the specific logic of the functional function exposed by the functional module. The function description submodule is very small because the function description submodule does not relate to the specific implementation logic of the function. When the first functional module depends on the second functional module, only the function description sub-module in the second functional module can be relied on, and the function realization sub-module in the second functional module is not relied on, so that when compiling, only the compiling result of the function description sub-module in the second functional module can be added into the compiling result of the first functional module to complete the compiling operation of the first functional module, and the compiling result of the function realization sub-module in the second functional module does not need to be added, thereby greatly reducing the file copy number and improving the compiling efficiency. Moreover, the first functional module may obtain the function implementation object corresponding to the function implementation sub-module in the second functional module according to the dependent function description sub-module, and may call the function in the second functional module based on the function implementation object, thereby improving the compiling efficiency and ensuring that the original function of the functional module remains unchanged.
Optionally, the apparatus further comprises:
the function description submodule creating unit is used for creating a function description submodule in each function module before acquiring a function description submodule in a second function module which is depended by the first function module;
and the function realization sub-module creating unit is used for creating the association between the function description sub-module and the function realization sub-module to be created and creating the corresponding function realization sub-module based on the association.
Optionally, the function description submodule creating unit is specifically configured to:
the function description protocol in the function module inherits the keyword through a calling interface, inherits a preset basic protocol, and describes the function information of the exposed function in the inherited function description protocol so as to obtain a function description submodule in the function module.
Optionally, the function implementation sub-module creating unit is specifically configured to:
naming the function description sub-module based on a preset naming mode; and establishing the association between the function description submodule and the function realization submodule to be created according to the module name of the function description submodule.
Optionally, the function implementation sub-module creating unit is further specifically configured to:
based on the association, acquiring a function description protocol in the associated function description submodule; and the function implementation class in the function module inherits the acquired function description protocol by calling an interface inheritance keyword, duplicates each function in the function description protocol, and writes specific implementation logic of each function so as to obtain a corresponding function implementation sub-module.
Optionally, the apparatus further comprises:
a function realization object obtaining module, configured to instantiate the function realization class in the function realization sub-module to obtain a corresponding function realization object;
and the function realization object storage module is used for storing the function description protocol and the function realization object into a preset memory in a key value pair mode.
Optionally, the first functional module includes:
a target function description protocol obtaining unit, configured to obtain a target function description protocol in the function description submodule depended on;
and the target function realization object acquisition unit is used for inquiring a target function realization object corresponding to the target function description protocol from the preset memory according to the target function description protocol, and the target function realization object is used as a function realization object corresponding to the function realization submodule in the second functional module.
The compiling device of the functional module provided by the embodiment of the invention can execute the compiling method of the functional module provided by any embodiment of the invention, and has the corresponding functional module and beneficial effects of the compiling method of the functional module.
Example four
Fig. 4 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention. Referring to fig. 4, the apparatus includes:
one or more processors 410;
a memory 420 for storing one or more programs;
when the one or more programs are executed by the one or more processors 410, the one or more processors 410 are caused to implement a method for compiling functional modules as provided in any of the embodiments above, the method comprising:
acquiring function description sub-modules in a second function module which is depended by a first function module, wherein each function module comprises a function description sub-module and a function realization sub-module, and the function description sub-modules are used for describing function information of function functions exposed by the function modules; the function realization sub-module is used for realizing the specific logic of the function exposed by the function module;
compiling function description sub-modules in the first function module and the second function module, and adding a compiling result of the function description sub-module in the second function module to a compiling result of the first function module;
and the first functional module acquires a function implementation object corresponding to the function implementation submodule in the second functional module according to the function description submodule depended on, and calls a functional function in the second functional module based on the function implementation object.
In FIG. 4, a processor 410 is illustrated as an example; the processor 410 and the memory 420 in the device may be connected by a bus or other means, as exemplified by the bus connection in fig. 4.
The memory 420 serves as a computer-readable storage medium, and may be used to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the compiling method of the functional module in the embodiment of the present invention (for example, the functional description submodule acquiring unit 310 and the compiling unit 320 in the compiling apparatus of the functional module). The processor 410 executes various functional applications of the device and data processing, i.e., implements the above-described compiling method of the functional modules, by executing the software programs, instructions, and modules stored in the memory 420.
The memory 420 mainly includes a program storage area and a data storage area, wherein the program storage area can store an operating system and an application program required by at least one function; the storage data area may store data created according to use of the device, and the like. Further, the memory 420 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, memory 420 may further include memory located remotely from processor 410, which may be connected to devices through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The device proposed in this embodiment and the compiling method for functional modules proposed in the above embodiments belong to the same inventive concept, and technical details that are not described in detail in this embodiment can be referred to the above embodiments, and this embodiment has the same advantageous effects as the compiling method for executing functional modules.
EXAMPLE five
The present embodiment provides a computer-readable storage medium on which a computer program is stored, which when executed by a processor implements the method steps of compiling functional modules provided in any of the embodiments of the present invention, the method including:
acquiring function description sub-modules in a second function module which is depended by a first function module, wherein each function module comprises a function description sub-module and a function realization sub-module, and the function description sub-modules are used for describing function information of function functions exposed by the function modules; the function realization sub-module is used for realizing the specific logic of the function exposed by the function module;
compiling function description sub-modules in the first function module and the second function module, and adding a compiling result of the function description sub-module in the second function module to a compiling result of the first function module;
and the first functional module acquires a function implementation object corresponding to the function implementation submodule in the second functional module according to the function description submodule depended on, and calls a functional function in the second functional module based on the function implementation object.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer-readable storage medium may be, for example but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It will be understood by those skilled in the art that the modules or steps of the invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and optionally they may be implemented by program code executable by a computing device, such that it may be stored in a memory device and executed by a computing device, or it may be separately fabricated into various integrated circuit modules, or it may be fabricated by fabricating a plurality of modules or steps thereof into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A method for compiling a functional module, comprising:
acquiring function description sub-modules in a second function module which is depended by a first function module, wherein each function module comprises a function description sub-module and a function realization sub-module, and the function description sub-modules are used for describing function information of function functions exposed by the function modules; the function realization sub-module is used for realizing the specific logic of the function exposed by the function module;
compiling function description sub-modules in the first function module and the second function module, and adding a compiling result of the function description sub-module in the second function module to a compiling result of the first function module;
and the first functional module acquires a function implementation object corresponding to the function implementation submodule in the second functional module according to the function description submodule depended on, and calls a functional function in the second functional module based on the function implementation object.
2. The method of claim 1, before obtaining the function description submodule in the second functional module on which the first functional module depends, further comprising:
creating a function description submodule in each functional module;
and establishing the association between the function description sub-module and the function realization sub-module to be established, and establishing the corresponding function realization sub-module based on the association.
3. The method of claim 2, wherein creating a function description submodule in each functional module comprises:
the function description protocol in the function module inherits the keyword through a calling interface, inherits a preset basic protocol, and describes the function information of the exposed function in the inherited function description protocol so as to obtain a function description submodule in the function module.
4. The method of claim 2, wherein establishing an association between the function description submodule and a function implementation submodule to be created comprises:
naming the function description sub-module based on a preset naming mode;
and establishing the association between the function description submodule and the function realization submodule to be created according to the module name of the function description submodule.
5. The method of claim 2, wherein creating a corresponding functional implementation sub-module based on the association comprises:
based on the association, acquiring a function description protocol in the associated function description submodule;
and the function implementation class in the function module inherits the acquired function description protocol by calling an interface inheritance keyword, duplicates each function in the function description protocol, and writes specific implementation logic of each function so as to obtain a corresponding function implementation sub-module.
6. The method of claim 5, further comprising:
instantiating the function implementation class in the function implementation sub-module to obtain a corresponding function implementation object;
and storing the function description protocol and the function realization object into a preset memory in a key value pair mode.
7. The method according to claim 6, wherein obtaining, according to the dependent function description sub-module, a function implementation object corresponding to a function implementation sub-module in the second function module includes:
acquiring a target function description protocol in the dependent function description submodule;
and inquiring a target function realization object corresponding to the target function description protocol from the preset memory according to the target function description protocol, wherein the target function realization object is used as a function realization object corresponding to a function realization submodule in the second function module.
8. An apparatus for compiling a functional module, comprising:
the function description submodule acquisition unit is used for acquiring function description submodules in second function modules depended by the first function modules, wherein each function module comprises a function description submodule and a function realization submodule, and the function description submodule is used for describing function information of the function functions exposed by the function modules; the function realization sub-module is used for realizing the specific logic of the function exposed by the function module;
the compiling unit is used for compiling the function description sub-modules in the first function module and the second function module and adding the compiling result of the function description sub-module in the second function module to the compiling result of the first function module;
and the first functional module acquires a function implementation object corresponding to the function implementation submodule in the second functional module according to the function description submodule depended on, and calls a functional function in the second functional module based on the function implementation object.
9. An apparatus, characterized in that the apparatus comprises:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a method of compiling a functional module according to any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a method of compiling a functional module according to any one of claims 1 to 7.
CN202011118344.4A 2020-10-19 2020-10-19 Compiling method, device, equipment and storage medium of functional module Pending CN114385174A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011118344.4A CN114385174A (en) 2020-10-19 2020-10-19 Compiling method, device, equipment and storage medium of functional module

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011118344.4A CN114385174A (en) 2020-10-19 2020-10-19 Compiling method, device, equipment and storage medium of functional module

Publications (1)

Publication Number Publication Date
CN114385174A true CN114385174A (en) 2022-04-22

Family

ID=81192936

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011118344.4A Pending CN114385174A (en) 2020-10-19 2020-10-19 Compiling method, device, equipment and storage medium of functional module

Country Status (1)

Country Link
CN (1) CN114385174A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116302218A (en) * 2023-03-15 2023-06-23 北京百度网讯科技有限公司 Function information adding method, device, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116302218A (en) * 2023-03-15 2023-06-23 北京百度网讯科技有限公司 Function information adding method, device, equipment and storage medium
CN116302218B (en) * 2023-03-15 2024-05-10 北京百度网讯科技有限公司 Function information adding method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
US7120916B1 (en) Protocol agnostic web listener
CN104679572B (en) Plug-in unit based on preload mechanisms supports method
CN110764748B (en) Code calling method, device, terminal and storage medium
CN107402792B (en) Integration method, device, equipment and storage medium of application software installation package
US10754628B2 (en) Extracting web API endpoint data from source code to identify potential security threats
CN110968340A (en) Method and device for realizing multi-version dependence isolation
CN111045746B (en) Code expansion method and framework
WO2022062634A1 (en) Method, apparatus, device, and storage medium for integrating map service in service
CN110933188A (en) Remote service calling method, system, server and storage medium
CN114840310A (en) Container creation method, device, electronic equipment and computer-readable storage medium
CN114385174A (en) Compiling method, device, equipment and storage medium of functional module
CN109343970B (en) Application program-based operation method and device, electronic equipment and computer medium
CN108874837A (en) Database divides library method, apparatus, middleware and storage medium and electronic equipment
CN112988175A (en) Cross-platform application installation package generation method, device, medium and electronic equipment
CN112905273A (en) Service calling method and device
CN113127775A (en) Page loading method, device, equipment and storage medium
EP4102361A2 (en) Method and apparatus for managing functions of a query engine
CN113626001B (en) API dynamic arrangement method and device based on script
CN113709171A (en) Method and device for cross-component state communication
CN112711602B (en) Method and device for running stored procedure, database system and storage medium
US20220283789A1 (en) Methods and apparatuses for providing a function as a service platform
CN112988125B (en) Data bridging method, device, equipment and storage medium
CN113055393A (en) Security service method, device and equipment
CN115033315A (en) Page flow control method and device, electronic equipment and storage medium
CN113761038A (en) Data source read-write separation method and device

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