CN106951248B - Method and device for adding codes, readable storage medium and computing equipment - Google Patents

Method and device for adding codes, readable storage medium and computing equipment Download PDF

Info

Publication number
CN106951248B
CN106951248B CN201710156806.3A CN201710156806A CN106951248B CN 106951248 B CN106951248 B CN 106951248B CN 201710156806 A CN201710156806 A CN 201710156806A CN 106951248 B CN106951248 B CN 106951248B
Authority
CN
China
Prior art keywords
code
event
add
application
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.)
Expired - Fee Related
Application number
CN201710156806.3A
Other languages
Chinese (zh)
Other versions
CN106951248A (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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN201710156806.3A priority Critical patent/CN106951248B/en
Publication of CN106951248A publication Critical patent/CN106951248A/en
Application granted granted Critical
Publication of CN106951248B publication Critical patent/CN106951248B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons

Landscapes

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

Abstract

The embodiment of the invention provides a method, a device, a readable storage medium and a computing device for adding codes. The method comprises the following steps: displaying an application interface of an application program; determining an event needing to add code on the application interface; determining code content required to be added in a code file of the application program and an adding position of the code content according to the event requiring to add the code; adding code to the code file based on the code content and the addition location. The technical scheme of the invention can facilitate the code adding operation of developers on the premise of reducing technical risks, improve the code adding efficiency and reduce human errors.

Description

Method and device for adding codes, readable storage medium and computing equipment
Technical Field
The embodiment of the invention relates to the technical field of communication and computers, in particular to a method, a device, a readable storage medium and a computing device for adding codes.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
At present, the schemes for adding codes to events (such as long press, sliding, displaying, clicking, etc.) occurring on a terminal display interface mainly include a search addition scheme and a binding addition scheme.
There are two common ways to find an addition scheme: the method 1 is that a developer is required to find a position in a code file where a code needs to be added, and then the code is added at the position; mode 2 is to use a method replacement technology, i.e. writing a replacement method, and add the code to be added to the replacement method.
The binding addition scheme mainly binds the event needing to add the code with the code so as to realize the operation of adding the code. Taking the click event as an example, the code to be added is bound with the click event in the code, and then all the click events occur to trigger the operation of adding the code.
Disclosure of Invention
However, in the current search and addition scheme, since developers need to manually search and add, the dependence of the addition effect on the operation of the developers is high, the error probability is high, repeated operations of the developers are also needed for repeated codes, and the effect of code addition needs to be verified one by the developers, which is tedious in operation. For the current binding addition scheme, because the codes bound by the same event are all the same, the customization of the codes cannot be realized; meanwhile, the binding addition mode may affect the system bottom layer code, and the technical risk is high.
Therefore, an improved scheme for adding codes is highly needed, which can facilitate the code adding operation of developers on the premise of reducing technical risks, improve the code adding efficiency, and reduce human errors.
In this context, embodiments of the present invention are intended to provide a method and apparatus for adding code.
In a first aspect of embodiments of the present invention, there is provided a method of adding code, including: displaying an application interface of an application program; determining an event needing to add code on the application interface; determining code content required to be added in a code file of the application program and an adding position of the code content according to the event requiring to add the code; adding code to the code file based on the code content and the addition location.
In some embodiments of the present invention, based on the foregoing solution, the step of determining an event on the application interface that needs to add code includes: loading an interface plug-in; and detecting the event needing to add the code based on the interface plug-in.
In some embodiments of the present invention, based on the foregoing solution, the step of detecting the event requiring code addition based on the interface plug-in includes: detecting an application control selected by a user on the application interface; and taking the event corresponding to the application control selected by the user as the event needing to add the code.
In some embodiments of the present invention, based on the foregoing scheme, the method further comprises: and if the application control selected by the user corresponds to a plurality of events, taking the event selected by the user from the plurality of events as the event needing to add the code.
In some embodiments of the present invention, based on the above scheme, after the interface plug-in is loaded, the interface plug-in forms a transparent or semi-transparent cover layer covering the application interface.
In some embodiments of the present invention, based on the foregoing scheme, the step of determining the code content required to be added in the code file of the application program includes: and generating the code content according to the parameters of the event needing to add the code and a code template applicable to the event needing to add the code.
In some embodiments of the present invention, based on the foregoing scheme, parameters of the event that needs to be added with code are passed to the code template to generate the code content.
In some embodiments of the present invention, based on the foregoing scheme, the method further comprises: and aiming at the application control on the application interface and the event corresponding to the application control, creating at least one code template.
In some embodiments of the present invention, based on the foregoing scheme, the step of determining the adding position of the code content includes: acquiring a class to which an application control corresponding to the event needing to add the code belongs and a function corresponding to the event needing to add the code; and determining the adding position of the code content according to the class and the function.
In some embodiments of the present invention, based on the foregoing scheme, the step of adding code to the code file based on the code content and the adding position includes: generating a configuration file based on the code content and the adding position; and analyzing the configuration file through a script file to add codes to the code file.
In a second aspect of the embodiments of the present invention, there is provided an apparatus for adding a code, including: the display unit is used for displaying an application interface of an application program; the processing unit is used for determining an event needing to add codes on the application interface; the determining unit is used for determining the code content required to be added in the code file of the application program and the adding position of the code content according to the event requiring to add the code; and the adding unit is used for adding codes into the code file based on the code content and the adding position.
In some embodiments of the present invention, based on the foregoing solution, the processing unit is configured to: loading an interface plug-in; and detecting the event needing to add the code based on the interface plug-in.
In some embodiments of the present invention, based on the foregoing solution, the processing unit is configured to: detecting an application control selected by a user on the application interface; and taking the event corresponding to the application control selected by the user as the event needing to add the code.
In some embodiments of the present invention, based on the foregoing solution, if the application control selected by the user corresponds to multiple events, the event selected by the user in the multiple events is taken as the event requiring code addition.
In some embodiments of the present invention, based on the above scheme, after the interface plug-in is loaded, the interface plug-in forms a transparent or semi-transparent cover layer covering the application interface.
In some embodiments of the present invention, based on the foregoing scheme, the determining unit is configured to: and generating the code content according to the parameters of the event needing to add the code and a code template applicable to the event needing to add the code.
In some embodiments of the present invention, based on the foregoing scheme, the determining unit is configured to: and transferring parameters of the event needing to add the code into the code template to generate the code content.
In some embodiments of the present invention, based on the foregoing scheme, the method further comprises: and the creating unit is used for creating at least one code template aiming at the application control on the application interface and the event corresponding to the application control.
In some embodiments of the present invention, based on the foregoing scheme, the determining unit is configured to: acquiring a class to which an application control corresponding to the event needing to add the code belongs and a function corresponding to the event needing to add the code; and determining the adding position of the code content according to the class and the function.
In some embodiments of the present invention, based on the foregoing scheme, the adding unit is configured to: generating a configuration file based on the code content and the adding position; and analyzing the configuration file through a script file to add codes to the code file.
In a third aspect of embodiments of the present invention, there is provided a readable storage medium, on which a program is stored, which program, when executed by a processor, implements a method as described in the first aspect above.
According to the method and the device for adding the codes, the application interface of the application program is displayed, the event needing to be added with the codes on the application interface, the code content needing to be added aiming at the event and the adding position of the code content are determined, and the codes are added based on the determined code content and the adding position, so that a developer can select the event needing to be added with the codes on the application interface based on a visual operation mode without searching the adding position of the codes in a code file one by one, and the code adding operation of the developer is greatly facilitated. Meanwhile, because the code is automatically added (for example, the code can be added through a script file), the code adding efficiency is improved, and human errors can be effectively reduced.
In a fourth aspect of embodiments of the present invention, there is provided a computing device comprising: a processor and a memory, the memory storing executable instructions, the processor being configured to invoke the memory stored executable instructions to perform the method according to the first aspect.
According to the method and the device for adding the codes, disclosed by the embodiment of the invention, by creating at least one code template, the situation that developers write the same codes repeatedly can be avoided, and the workload of the developers is effectively reduced. And the parameters of the event of the code are added according to the needs and the code template applicable to the event generates the code content, so that the generated code content can correspond to the specific event, and the customization of the code content is realized. Meanwhile, the technical scheme of the embodiment of the invention can also avoid the problem of higher technical risk in the current binding addition scheme.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the invention are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
FIG. 1 schematically shows a flow chart of a method of adding code according to a first embodiment of the invention;
FIG. 2 schematically illustrates a flow diagram for determining an event on an application interface requiring the addition of code, according to an embodiment of the invention;
FIG. 3 schematically shows a flow chart of a method of adding code according to a second embodiment of the invention;
FIG. 4 schematically illustrates an interface effect diagram before and after launching an interface plug-in according to an embodiment of the invention;
fig. 5 schematically shows a block diagram of an apparatus for adding code according to an embodiment of the present invention.
In the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
Detailed Description
The principles and spirit of the present invention will be described with reference to a number of exemplary embodiments. It is understood that these embodiments are given solely for the purpose of enabling those skilled in the art to better understand and to practice the invention, and are not intended to limit the scope of the invention in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
As will be appreciated by one skilled in the art, embodiments of the present invention may be embodied as a system, apparatus, device, method, or computer program product. Accordingly, the present disclosure may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), or a combination of hardware and software.
According to the embodiment of the invention, a method and a device for adding codes are provided.
In this context, it is to be understood that the term "application" as referred to refers to a computer program intended to perform some specific task or tasks, including but not limited to apps in mobile devices (e.g., smartphones, tablets, etc.). The term "application Interface" refers to a User Interface (UI) of an application. The term "event" refers to an operation that can be recognized by a control, such as pressing a decision button, selecting a radio button or check box, and the like. The term "plug-in" is a program written in an application program interface that follows a certain specification. The term "script" is an executable file written in a certain format using a particular descriptive language, also called macro or batch file.
Moreover, any number of elements in the drawings are by way of example and not by way of limitation, and any nomenclature is used solely for differentiation and not by way of limitation.
The principles and spirit of the present invention are explained in detail below with reference to several representative embodiments of the invention.
Summary of The Invention
The inventor finds that the scheme of searching for the added code in the prior art needs a developer to manually search for the added code, the adding effect of the added code has high operation dependency on the developer, the error probability is high, the repeated operation of the developer is also needed for the repeated code, the effect of adding the code needs to be verified one by the developer, and the operation is complicated. The scheme of binding and adding codes may affect the system bottom layer codes, the technical risk is high, and the codes bound by the same event are the same, so that the customization of the codes cannot be realized.
Therefore, the embodiment of the invention provides an improved method and device for adding codes, which can enable a developer to select an event needing to add codes on an application interface based on a visual operation mode, greatly facilitate the code adding operation of the developer, improve the code adding efficiency and reduce human errors.
In addition, the implementation mode of the invention can avoid the developer from repeatedly writing the same code by creating the code template, thereby effectively reducing the workload of the developer. And the corresponding code content can be generated according to the parameters of the event needing to add the code and the code template, so that the customization of the code content is realized. Meanwhile, the technical scheme of the embodiment of the invention can also avoid the problem of higher technical risk in the current binding addition scheme.
Having described the general principles of the invention, various non-limiting embodiments of the invention are described in detail below.
Application scene overview
The following application scenarios are merely illustrative for facilitating an understanding of the spirit and principles of the present invention, and embodiments of the present invention are not limited in any way in this respect. Rather, embodiments of the present invention may be applied to any scenario where applicable.
Scene one: when a developer needs to add codes aiming at events on an application interface, the events needing to be added with the codes can be directly triggered on the application interface, and then the device for adding the codes can determine the contents of the codes needing to be added and the corresponding adding positions based on the events triggered by the developer, so that the contents of the codes are automatically added to the corresponding positions in the code files, and great convenience is brought to the operation of the developer.
Scene two: the method comprises the steps that a developer can configure at least one code template, and then after an event which is triggered by the developer and needs to be added is determined, parameters of the event can be transmitted into an applicable code template to generate code content which needs to be added, so that the problem that the developer writes the same code repeatedly and accordingly workload is large is solved, and customization of the code content can be achieved.
Exemplary method
A method of adding code according to an exemplary embodiment of the present invention is described below with reference to fig. 1 to 4 in conjunction with the above application scenarios.
Fig. 1 schematically shows a flow chart of a method of adding code according to a first embodiment of the invention.
As shown in fig. 1, the method for adding code according to the first embodiment of the present invention includes:
and step S12, displaying the application interface of the application program.
In the embodiment of the present invention, it is preferable that an application interface of the application program can be displayed by touching the display screen, so that interaction can be facilitated. Of course, the embodiment of the present invention is not limited to this, and for example, an application interface of an application program may be displayed through a general non-touch display screen.
And step S14, determining the event needing to add the code on the application interface.
According to an exemplary embodiment of the present invention, as shown in fig. 2, step S14 includes:
step S142, the interface plug-in is loaded.
The visual operation of a user can be provided on the premise of ensuring the visual display of the application interface through the interface plug-in. In embodiments of the present invention, when the interface plug-in is loaded, the interface plug-in may form a transparent or translucent overlay that overlays the application interface.
And step S144, detecting the event needing to add the code based on the interface plug-in.
According to an exemplary embodiment of the present invention, step S144 includes: and detecting an application control selected by a user on the application interface, and taking an event corresponding to the application control selected by the user as the event needing to add the code.
And if the application control selected by the user corresponds to a plurality of events, taking the event selected by the user from the plurality of events as the event needing to be added with codes.
Specifically, when the application control selected by the user corresponds to a plurality of events, the plurality of events can be presented to the user in a list or drop-down manner, so that the user can conveniently select the events.
And step S16, determining the code content to be added in the code file of the application program and the adding position of the code content according to the event needing to add codes.
According to the exemplary embodiment of the present invention, step S16 includes a scheme of determining code content that needs to be added and a scheme of determining the adding position of the code content, which are separately described below:
determining added code content
And generating the code content according to the parameters of the event needing to add the code and a code template applicable to the event needing to add the code. In a specific embodiment of the present invention, parameters of the event that needs to add code may be passed to the code template to generate the code content.
The code content is generated by adding the parameters of the event of the code according to the needs and the code template used by the event, so that on one hand, developers do not need to write repeated codes, and the workload of the developers is reduced; on the other hand, the generated code content can be corresponding to specific events, and the customization of the code is realized.
In the embodiment of the invention, at least one code template can be created for an application control on an application interface and an event corresponding to the application control. For example, one or more code templates may be created for the same type of application controls on the application interface, and the code template applicable to the event corresponding to the application controls is determined, so that the code template applicable to the event can be determined according to the event to which the code needs to be added.
Determining the location of addition of code content
Acquiring a class to which an application control corresponding to the event needing to add the code belongs and a function corresponding to the event needing to add the code; and determining the adding position of the code content according to the class and the function.
It should be noted that the insertion point of the code can be determined according to the class to which the application control corresponding to the event belongs and the function corresponding to the event, and therefore the adding position of the code content can be determined based on this. In the embodiment of the present invention, a function corresponding to an event to which a code needs to be added may be obtained from a code file of an application program, and if there is no function corresponding to the event in the code file, a function corresponding to the event needs to be created.
And step S18, adding codes into the code file based on the code content and the adding position.
According to an exemplary embodiment of the present invention, step S18 includes: generating a configuration file based on the code content and the adding position; and analyzing the configuration file through a script file to add codes to the code file.
In the embodiment of the present invention, the configuration file may be in JSON (JavaScript object notification, a lightweight data exchange format), for example, the following format may be used:
[{"className":"class1","insert":[{"methodName":"method1","insertCode":"codeXXX"},{"methodName":"method2","insertCode":"codeXXX"}],"create":[{"methodName":"method1","insertCode":"codeXXX"},{"methodName":"method2","insertCode":"codeXXX"}]},…]
the technical scheme of the embodiment of the invention is explained by taking the added code of the IOS system as an example as follows:
as shown in fig. 3, a method of adding code according to a second embodiment of the present invention includes:
step S302, customizing the code template. This step is a step of creating a code template in the first embodiment of the present invention, and is intended to generate the code content to be added according to the parameters of the event to be added with the code and the created code template.
It should be noted that: the code template is mainly a function template, for example, the code template customized for the event of clicking the control can be [ TrackManager XXXButtonClicked ], wherein the 'XXX' in the template is related to the control of a specific operation, so that the customization of the code can be realized.
And step S304, operating the interface plug-in, operating on the interface plug-in, and selecting an event needing to add a code. This step is an exemplary embodiment of step S14 in the above-described first embodiment of the present invention, i.e., the processes of step S142 and step S144 shown in fig. 2. Of course, before step S304, the application interface of the application program needs to be displayed.
As shown in FIG. 4, upon launching the interface plug-in, the interface plug-in may form a translucent overlay that overlays the application interface. After a triggering operation (e.g., long press), the control 402 shown in fig. 4 is clicked and a code template is selected, and then a parameter (e.g., a character string "search") of the click event is input into the code template to generate code content. This process is a specific implementation process of step S16 in the above first embodiment of the present invention.
It should be noted that, after the interface plug-in is started, the interface plug-in may also form a transparent overlay layer covering the application interface.
Step S306, generating a configuration file. For example, the format of the generated configuration file is as follows:
[{"className":"SubscribeViewController","insert":[{"methodName":"onSearchButtonClick","insertCode":"TrackManager searchButtonClicked"}]}]
step S308, the script file is run to analyze the configuration file so as to add the code content to the code file. Specifically, for the example in step S306, after the script file is run, a code [ TrackManager searchbutton click ] is added at the end of the onsearchbutton click method in the SubscribeViewController class.
Step S306 and step S308 shown in fig. 3 are an exemplary implementation of step S18 in the above first embodiment of the present invention, that is, a configuration file is generated, and the configuration file is parsed based on the script file to add code content to the code file.
Exemplary devices
Having described the method of the exemplary embodiment of the present invention, the apparatus for adding code of the exemplary embodiment of the present invention will be described next with reference to fig. 5.
Referring to fig. 5, an apparatus 500 for adding code according to an embodiment of the present invention includes: a display unit 502, a processing unit 504, a determination unit 506, and an adding unit 508.
Specifically, the display unit 502 is used for displaying an application interface of an application program; the processing unit 504 is configured to determine an event on the application interface that requires adding code; the determining unit 506 is configured to determine, according to the event that a code needs to be added, a code content that needs to be added in a code file of the application program and an adding position of the code content; the adding unit 508 is configured to add a code to the code file based on the code content and the adding position.
In some embodiments of the present invention, based on the foregoing solution, the processing unit 504 is configured to: loading an interface plug-in; and detecting the event needing to add the code based on the interface plug-in.
In some embodiments of the present invention, based on the foregoing solution, the processing unit 504 is configured to: detecting an application control selected by a user on the application interface; and taking the event corresponding to the application control selected by the user as the event needing to add the code.
In some embodiments of the present invention, based on the foregoing solution, if the application control selected by the user corresponds to multiple events, the event selected by the user in the multiple events is taken as the event requiring code addition.
In some embodiments of the present invention, based on the above scheme, after the interface plug-in is loaded, the interface plug-in forms a transparent or semi-transparent cover layer covering the application interface.
In some embodiments of the present invention, based on the foregoing scheme, the determining unit 506 is configured to: and generating the code content according to the parameters of the event needing to add the code and a code template applicable to the event needing to add the code.
In some embodiments of the present invention, based on the foregoing scheme, the determining unit 506 is configured to: and transferring parameters of the event needing to add the code into the code template to generate the code content.
In some embodiments of the present invention, based on the foregoing scheme, the method further comprises: a creating unit 510, configured to create at least one code template for an application control on the application interface and an event corresponding to the application control.
In some embodiments of the present invention, based on the foregoing scheme, the determining unit 506 is configured to: acquiring a class to which an application control corresponding to the event needing to add the code belongs and a function corresponding to the event needing to add the code; and determining the adding position of the code content according to the class and the function.
In some embodiments of the present invention, based on the foregoing scheme, the adding unit 508 is configured to: generating a configuration file based on the code content and the adding position; and analyzing the configuration file through a script file to add codes to the code file.
Exemplary device
Having described the method and apparatus of an exemplary embodiment of the present invention, a device for adding code according to another exemplary embodiment of the present invention is described next.
As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or program product. Thus, various aspects of the invention may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
In some possible embodiments, an apparatus for adding code according to embodiments of the present invention may include at least one processing unit, and at least one memory unit. Wherein the storage unit stores program code which, when executed by the processing unit, causes the processing unit to perform the steps of the method of adding code according to various exemplary embodiments of the present invention described in the above section "exemplary method" of the present specification. For example, the processing unit may execute step S12 shown in fig. 1, displaying an application interface of an application; step S14, determining the event needing to add code on the application interface; step S16, according to the event needing adding code, determining the code content needing to be added in the code file of the application program and the adding position of the code content; and step S18, adding codes into the code file based on the code content and the adding position. As another example, the processing unit may also perform the steps shown in any of fig. 2 and 3.
Exemplary program product
In some possible embodiments, aspects of the present invention may also be implemented in the form of a program product comprising program code for causing a device to perform the steps of the method of adding code according to various exemplary embodiments of the present invention described in the "exemplary methods" section above of this specification when the program product is run on the device, for example, the device may perform step S12 as shown in fig. 1, displaying an application interface of an application; step S14, determining the event needing to add code on the application interface; step S16, according to the event needing adding code, determining the code content needing to be added in the code file of the application program and the adding position of the code content; and step S18, adding codes into the code file based on the code content and the adding position. As another example, the terminal device may also perform the steps shown in any one of fig. 2 and fig. 3.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, 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.
A readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a 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 readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, etc., or any suitable combination of the foregoing.
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, 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 computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device over any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., over the internet using an internet service provider).
It should be noted that although in the above detailed description, reference has been made to several units or sub-units of the apparatus adding the code, such division is merely exemplary and not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit according to embodiments of the invention. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Moreover, while the operations of the method of the invention are depicted in the drawings in a particular order, this does not require or imply that the operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
While the spirit and principles of the invention have been described with reference to several particular embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, nor is the division of aspects, which is for convenience only as the features in such aspects may not be combined to benefit. The invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (18)

1. A method of adding code, comprising:
displaying an application interface of an application program;
determining an event needing to add code on the application interface;
generating code content to be added in the code file of the application program according to the parameters of the event needing to add the code and the code template applicable to the event;
determining the adding position of the code content according to the class to which the application control corresponding to the event needing to add the code belongs and the function corresponding to the event needing to add the code;
generating a configuration file based on the code content and the adding position;
and analyzing the configuration file through a script file to add codes to the code file.
2. The method of claim 1, wherein determining an event on the application interface that requires adding code comprises:
loading an interface plug-in;
and detecting the event needing to add the code based on the interface plug-in.
3. The method of claim 2, wherein the step of detecting the event requiring code addition based on the interface plug-in comprises:
detecting an application control selected by a user on the application interface;
and taking the event corresponding to the application control selected by the user as the event needing to add the code.
4. The method of claim 3, further comprising:
and if the application control selected by the user corresponds to a plurality of events, taking the event selected by the user from the plurality of events as the event needing to add the code.
5. The method of claim 2, wherein upon loading the interface plug-in, the interface plug-in forms a transparent or translucent overlay covering the application interface.
6. The method of claim 1, wherein parameters of the event requiring the addition of code are passed into the code template to generate the code content.
7. The method of claim 1, further comprising:
and aiming at the application control on the application interface and the event corresponding to the application control, creating at least one code template.
8. The method of claim 1, wherein prior to the step of determining the addition location of the code content, the method further comprises:
and acquiring the class to which the application control corresponding to the event needing to add the code belongs and the function corresponding to the event needing to add the code.
9. An apparatus for adding code, comprising:
the display unit is used for displaying an application interface of an application program;
the processing unit is used for determining an event needing to add codes on the application interface;
the determining unit is used for generating code content to be added in the code file of the application program according to the parameters of the event needing to add the code and the code template applicable to the event; determining the adding position of the code content according to the class to which the application control corresponding to the event needing to add the code belongs and the function corresponding to the event needing to add the code;
an adding unit configured to generate a configuration file based on the code content and the adding position; and analyzing the configuration file through a script file to add codes to the code file.
10. The apparatus of claim 9, wherein the processing unit is configured to:
loading an interface plug-in;
and detecting the event needing to add the code based on the interface plug-in.
11. The apparatus of claim 10, wherein the processing unit is configured to:
detecting an application control selected by a user on the application interface;
and taking the event corresponding to the application control selected by the user as the event needing to add the code.
12. The apparatus according to claim 11, wherein if the application control selected by the user corresponds to a plurality of events, the event selected by the user in the plurality of events is taken as the event requiring code addition.
13. The apparatus of claim 10, wherein upon loading the interface plug-in, the interface plug-in forms a transparent or translucent overlay covering the application interface.
14. The apparatus of claim 9, wherein the determining unit is configured to:
and transferring parameters of the event needing to add the code into the code template to generate the code content.
15. The apparatus of claim 9, further comprising:
and the creating unit is used for creating at least one code template aiming at the application control on the application interface and the event corresponding to the application control.
16. The apparatus of claim 9, wherein the determining unit is configured to:
acquiring a class to which an application control corresponding to the event needing to add the code belongs and a function corresponding to the event needing to add the code;
and determining the adding position of the code content according to the class and the function.
17. A readable storage medium on which a program is stored which, when executed by a processor, implements the method of any one of claims 1 to 8.
18. A computing device, comprising: a processor and a memory, the memory storing executable instructions, the processor to invoke the memory-stored executable instructions to perform the method of any of claims 1 to 8.
CN201710156806.3A 2017-03-16 2017-03-16 Method and device for adding codes, readable storage medium and computing equipment Expired - Fee Related CN106951248B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710156806.3A CN106951248B (en) 2017-03-16 2017-03-16 Method and device for adding codes, readable storage medium and computing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710156806.3A CN106951248B (en) 2017-03-16 2017-03-16 Method and device for adding codes, readable storage medium and computing equipment

Publications (2)

Publication Number Publication Date
CN106951248A CN106951248A (en) 2017-07-14
CN106951248B true CN106951248B (en) 2020-09-18

Family

ID=59473621

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710156806.3A Expired - Fee Related CN106951248B (en) 2017-03-16 2017-03-16 Method and device for adding codes, readable storage medium and computing equipment

Country Status (1)

Country Link
CN (1) CN106951248B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107797800B (en) * 2017-10-10 2020-12-15 平安科技(深圳)有限公司 Data processing method for multiple associated service systems, electronic device and medium
CN110020298A (en) * 2017-10-27 2019-07-16 北京国双科技有限公司 Parameter display method and apparatus
CN108776569B (en) * 2018-04-20 2021-10-15 贵阳朗玛信息技术股份有限公司 Method and device for modifying compiling option control file
CN109117127A (en) * 2018-08-21 2019-01-01 水木康益(北京)信息技术有限公司 Program code generation method, device and computer readable storage medium
CN109522010B (en) * 2018-11-22 2022-02-18 网易(杭州)网络有限公司 Initialization code adding method and device, storage medium and electronic equipment
CN111435312B (en) * 2019-01-15 2023-09-29 北京嘀嘀无限科技发展有限公司 Application program management method and device and electronic equipment
CN112346726B (en) * 2020-03-16 2023-12-12 成都华微电子科技股份有限公司 Method for automatically generating design codes based on form information

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6493006B1 (en) * 1996-05-10 2002-12-10 Apple Computer, Inc. Graphical user interface having contextual menus
US20060052884A1 (en) * 2004-09-08 2006-03-09 Staples Mathew L User interface builder application for building automation
CN101807209A (en) * 2010-04-14 2010-08-18 深圳市同洲电子股份有限公司 Method and system for manufacturing webpage, client and server
CN102707945A (en) * 2012-04-11 2012-10-03 佳都新太科技股份有限公司 Implementation method of form designer based on layout template in Eclipse
CN104899217B (en) * 2014-03-06 2018-09-25 阿里巴巴集团控股有限公司 A kind of implementation method and device of custom feature
CN104933019B (en) * 2015-06-05 2019-05-10 亚信科技(南京)有限公司 A kind of method and device that list generates
CN105335071A (en) * 2015-10-26 2016-02-17 百度在线网络技术(北京)有限公司 Method and device for displaying page elements

Also Published As

Publication number Publication date
CN106951248A (en) 2017-07-14

Similar Documents

Publication Publication Date Title
CN106951248B (en) Method and device for adding codes, readable storage medium and computing equipment
US9274934B2 (en) System and method for creating change-resilient scripts
CN107423048B (en) Data collection method, device, medium and computing equipment
US20160357519A1 (en) Natural Language Engine for Coding and Debugging
CN106844181B (en) Method, system and mobile terminal for recording user behavior
US20180024848A1 (en) Translatable Texts Identification in In-Context Localization Utilizing Pseudo-Language and an External Server
CN108319575B (en) Page component checking method, device, server and storage medium
CN111740948B (en) Data packet issuing method, dynamic updating method, device, equipment and medium
CN109873735B (en) Performance test method and device for H5 page and computer equipment
US9525716B2 (en) Ensuring availability and parameter format of URL scheme commands
US11741002B2 (en) Test automation systems and methods using logical identifiers
US20160246703A1 (en) Identifying the lines of code that caused the error as identified in the stack trace in a source code version that generated the stack trace that does not reside on the user's computing device
US10705858B2 (en) Automatic import of third party analytics
US20200183664A1 (en) User interface code re-use based upon machine learning of design documents
EP3522004A2 (en) Code execution and data processing pipeline
CN105512294A (en) Multi-media file update prompting method and device
CN107704499A (en) A kind of page jump control method and device of application program
CN114048415A (en) Form generation method and device, electronic equipment and computer readable storage medium
US20120089939A1 (en) Combined properties dialog from different sources
US20180165136A1 (en) A system, method, computer program and data signal for hosting and executing a program on a mainframe
US9075679B1 (en) Creating a prerequisite checklist corresponding to a software application
CN109408057B (en) Method, device, medium and computing equipment for automatically generating codes
EP3519964B1 (en) Electronic apparatus for recording debugging information and control method thereof
US20150081874A1 (en) Operation process creation program, operation process creation method, and information processing device
CN111767111B (en) Page data processing method and device, electronic equipment and storage medium

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20200918

CF01 Termination of patent right due to non-payment of annual fee