Program updating method, electronic equipment, storage medium and program product

By obtaining and analyzing the differential fragments between programs in development, building an information matrix and determining the editing operation sequence, the problem that mobile preview does not support code modification and incremental updates is solved, and the development efficiency and update speed are improved.

CN119806610APending Publication Date: 2025-04-11CHINA MOBILE INTERNET CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In the prior art, the mobile preview of the developed program does not support code modification and incremental updates, resulting in the need to recompile the entire program even for a small number of changes, which is time-consuming and labor-intensive and affects the development efficiency.

Method used

By obtaining the difference fragment between the first code and the second code of the developed program, an information matrix is ​​constructed to represent the operation direction of the code update, an editing operation sequence corresponding to the difference fragment is determined, and the preview program in the terminal is updated according to the sequence.

Benefits of technology

Improves the efficiency of the program development, reduces the need for recompilation, and only changes in different fragments are updated, thus saving time and resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806610A_ABST
    Figure CN119806610A_ABST
Patent Text Reader

Abstract

The invention discloses a program updating method, electronic equipment, a storage medium and a program product, belongs to the technical field of program preview, and is used for improving the development efficiency of a program. The method comprises the steps that under the condition that a first code of a program in development is updated into a second code, a difference fragment between the first code and the second code is obtained; according to operation information corresponding to the difference fragment, an information matrix is constructed, and the operation information represents the operation direction in which the first code is updated into the second code; according to the information matrix, determining an editing operation sequence corresponding to the difference fragment; and according to the editing operation sequence, updating an in-preview program corresponding to the in-development program in the terminal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of program preview, and specifically relates to a program updating method, electronic equipment, storage medium and program product. Background Art

[0002] The main steps of the existing implementation scheme for mobile preview of small programs in development are as follows: compile the source code into a program runtime code package, upload the runtime code package to the server, the server returns a link address where the program code package can be obtained, and the development tool generates a QR code from this link. The mobile terminal scans the QR code, obtains the previewed program code package through the link address, and downloads and loads the preview program. However, the mobile preview of the program in development does not support code modification and incremental updates. Even a small change requires recompiling the entire program, which is time-consuming and labor-intensive, affecting the efficiency of program development. Summary of the invention

[0003] The embodiments of the present application provide a program updating method, electronic device, storage medium and program product, which can solve the problem that even a small amount of modification requires recompiling the entire program, which is time-consuming and labor-intensive and affects program development efficiency.

[0004] In a first aspect, an embodiment of the present application provides a program updating method, the method comprising: when updating a first code of a program under development to a second code, obtaining a difference segment between the first code and the second code; constructing an information matrix based on operation information corresponding to the difference segment, the operation information indicating an operation direction of updating the first code to the second code; determining an editing operation sequence corresponding to the difference segment based on the information matrix; and updating a preview program corresponding to the program under development in a terminal based on the editing operation sequence.

[0005] In a second aspect, an embodiment of the present application provides a program updating device, which includes: an acquisition module, used to acquire a difference fragment between a first code and a second code of a program under development when updating the first code to the second code; a construction module, used to construct an information matrix according to operation information corresponding to the difference fragment, wherein the operation information indicates an operation direction of updating the first code to the second code; a determination module, used to determine an editing operation sequence corresponding to the difference fragment according to the information matrix; and an update module, used to update a preview program corresponding to the program under development in a terminal according to the editing operation sequence.

[0006] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.

[0007] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0008] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer performs the steps of the method described in the first aspect.

[0009] In an embodiment of the present application, by obtaining a difference segment between a first code and a second code of a program under development when the first code is updated to a second code; constructing an information matrix based on operation information corresponding to the difference segment, wherein the operation information indicates an operation direction of updating the first code to the second code; determining an editing operation sequence corresponding to the difference segment based on the information matrix; and updating a preview program corresponding to the program under development in a terminal based on the editing operation sequence, the development efficiency of the program can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Figure 1 It is a flowchart of a program updating method provided in an embodiment of the present application; Figure 2 is a structural diagram of a program updating device provided in an embodiment of the present application; Figure 3 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0012] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0013] The program update method, electronic device, storage medium and program product provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0014] Figure 1 A program update method provided by an embodiment of the present application is shown, and the method can be executed by an electronic device. In other words, the method can be executed by software or hardware installed in the electronic device, and the method includes the following steps: Step 102: when a first code of a program under development is updated to a second code, a difference segment between the first code and the second code is obtained.

[0015] In the embodiment of the present application, the program under development may be a medium-sized program or a small program, and the program under development is not specifically limited here. Specifically, when updating the program under development, that is, when the first code of the program under development is updated to the second code, it is necessary to obtain the difference fragment between the first code and the second code.

[0016] In one implementation, obtaining the difference segment between the first code and the second code includes: incrementally compiling the second code to find a target file with changes; and finding the difference segment between the first code and the second code from the target file.

[0017] Specifically, when updating the program under development in the development tool, the second code of the program under development can be incrementally compiled when it is running. The development tool can find the target files that have changed in the program and create a list of all the files that have changed to obtain a list of files that have changed. For each target file that has changed, the Histogram algorithm is used to compare the difference fragments between the first code and the second code at the same position before and after the change when the program is running, so as to obtain all the difference fragments in each file, that is, the difference fragments between the first code and the second code.

[0018] Step 104: construct an information matrix according to the operation information corresponding to the difference fragments.

[0019] Specifically, the operation information indicates the operation direction of updating the first code to the second code. After obtaining the difference fragments, an information matrix can be constructed according to the operation information corresponding to the difference fragments.

[0020] In one implementation, before constructing the information matrix according to the operation information corresponding to the difference fragment, it also includes: creating a pattern string corresponding to the difference fragment in the first code; creating a target string corresponding to the difference fragment in the second code; and initializing the information matrix according to the target string and the pattern string.

[0021] In an embodiment of the present application, for a difference segment with a difference, two strings and an information matrix corresponding to each difference segment are initialized. Specifically, there can be multiple difference segments, and the number of difference segments is not limited here. First, create a target string T corresponding to the second code of the difference segment after the program is updated when the program is running, and the other is a pattern string P corresponding to the first code of the difference segment before the program is updated when the program is running. Initialize an information matrix D, the number of rows of which is the length of the pattern string P plus 1, and the number of columns is the length of the target string T plus 1. Set the first column of the information matrix D (i.e., D[0][j], where j is from 0 to the target string length) to consecutive integers, starting from 0. Initialize a variable x to indicate the current matching position, with an initial value of 0. At each position (i, j) of the information matrix D, in addition to recording the minimum edit distance, an additional value is also recorded to indicate from which direction the current position is reached, which can be represented by the following symbols: D[i][j]: edit distance of the current position. INSERT: indicates reaching the current position from the top, indicating an insert operation. DELETE: indicates reaching the current position from the left, indicating a delete operation. MATCH: indicates reaching the current position from the upper left, indicating a match operation. REPLACE: indicates reaching the current position from the upper left and upper right, indicating a replace operation.

[0022] In one implementation, constructing an information matrix based on the operation information corresponding to the difference fragment includes: comparing the first character at the jth position of the target string with the second character at the ith position of the pattern string; when the first character is equal to the second character, filling the value of the element in the i+1th row and j+1th column of the information matrix as the operation information; when the first character is not equal to the second character, filling the minimum value of the value of the element in the i+1th row and j+1th column, the value of the element in the i+1th row and j+1th column, and the value of the element in the i+1th row and j+1th column in the information matrix plus 1 as the operation information into the element in the i+1th row and j+1th column of the information matrix, until the entire information matrix is ​​filled, wherein i and j are integers greater than or equal to 0.

[0023] Specifically, using the above-mentioned initialized target string, mode string, etc., the same positions in the two strings corresponding to the difference fragments before and after the mini program is updated are compared one by one, so as to fill the operation information obtained by comparison into the information matrix.

[0024] Specifically, the first character at the jth position of the target string and the second character at the ith position of the pattern string can be compared; when the first character is equal to the second character, the value of the element at the ith row and jth column in the information matrix is ​​used as the operation information to fill in the element at the i+1th row and j+1th column in the information matrix; when the first character is not equal to the second character, the minimum value of the value of the element at the ith row and jth column, the value of the element at the i+1th row and j+1th column, and the value of the element at the ith row and j+1th column in the information matrix plus 1 is used as the operation information to fill in the element at the i+1th row and j+1th column in the information matrix until the entire information matrix is ​​filled. For example, the following takes the filling of difference segment 1 into information matrix D1 as an example for description, starting from the first character of pattern string P corresponding to difference segment 1, each character of pattern string P is traversed. Correspondingly, starting from the first character of target string T corresponding to difference segment 1, each character of target string T is traversed.

[0025] Compare the target string character T[j] corresponding to the difference segment 1 with the corresponding pattern string character P[i] according to the following rules, and calculate the value of D[i+1][j+1], where i and j are integers greater than or equal to 0: If T[j] is equal to P[i], then D[i+1][j+1] is equal to D[i][j].

[0026] Otherwise, D[i+1][j+1] is equal to the minimum of the following three values ​​plus 1: D[i][j] (the value of the upper left corner of D[i+1][j+1]); D[i+1][j] (the value to the left of D[i+1][j+1]); D[i][j+1] (the value above D[i+1][j+1]).

[0027] Using the above rules, continue to fill the entire information matrix until all positions in the difference segment 1 are calculated, and obtain the information matrix D1 corresponding to the difference segment 1. Then perform the above steps for other difference segments, that is, fill in the information matrices corresponding to other difference segments, until all difference segments (for example, there are N difference segments) are compared, thereby obtaining the corresponding information matrices D1, D2, D3, ..., DN.

[0028] For the difference segments with differences, two strings and information matrices corresponding to each difference segment are initialized. By comparing the characters in the same position in the two strings, the operation information obtained by the comparison is filled into the information matrix to obtain a complete editing operation sequence. This technology has high accuracy because it accurately captures the differences between the difference segments and can also avoid unnecessary updates, thus saving time and resources. In addition, the maintainability of the information matrix is ​​provided because the operation information is structured and recorded in the information matrix, which is convenient for tracking and debugging.

[0029] Step 106: Determine the editing operation sequence corresponding to the difference segment according to the information matrix.

[0030] Specifically, after obtaining the information matrix, the editing operation sequence corresponding to the difference segment can be determined.

[0031] In one implementation, determining the editing operation sequence corresponding to the difference segment according to the information matrix includes: backtracking the information matrix; in the process of backtracking the information matrix, recording each editing operation according to the direction information to obtain the editing operation sequence.

[0032] Specifically, after filling all information matrices, backtracking can be used to obtain the editing operation sequence corresponding to each information matrix, so that N information matrices obtain their corresponding N editing operation sequences.

[0033] In one implementation, the backtracking of the information matrix includes: starting from the lower right corner of the information matrix and recording the direction information and backtracking toward the upper left corner according to the operation information corresponding to each value in the information matrix.

[0034] Specifically, starting from the lower right corner of the information matrix, the direction information can be recorded and traced back to the upper left corner according to the operation information corresponding to each value in the information matrix defined by the initialization above. During the backtracking process, the editing operation is determined according to the direction information. By recording each editing operation according to the direction information during the backtracking process, a complete editing operation sequence can be obtained, which includes insert, delete, match and replace operations. The embodiment of the present application provides a faster method to obtain the editing operation sequence, thereby accelerating the process of updating and previewing the mini program, reducing the need to recompile the entire mini program, and improving development efficiency.

[0035] Step 108: According to the editing operation sequence, the preview program corresponding to the developing program in the terminal is updated.

[0036] Specifically, after obtaining the editing operation sequence, the editing operation sequence may be sent to a terminal for previewing the program, thereby updating the preview program corresponding to the program under development in the terminal.

[0037] The program update method provided by the embodiment of the present application obtains the difference fragment between the first code and the second code when the first code of the program under development is updated to the second code; constructs an information matrix according to the operation information corresponding to the difference fragment, and the operation information indicates the operation direction of updating the first code to the second code; determines the editing operation sequence corresponding to the difference fragment according to the information matrix; and updates the preview program corresponding to the program under development in the terminal according to the editing operation sequence, so as to improve the development efficiency of the program. By filling the difference fragments that have changed after compilation into the setting information matrix, the information matrix records the direction information of the editing operation, and finally the complete editing operation sequence can be obtained by backtracking according to the direction information to execute the instruction to update the specified file, thereby completing the program update operation. The time and workload of program update are significantly reduced. In addition, since only the difference fragments that have changed need to be updated, it reduces the cost of the overall update operation. This is beneficial to both developers and end users because they can get the latest version of the program faster.

[0038] In one implementation, updating the preview program corresponding to the program under development in the terminal according to the editing operation sequence includes: converting the editing operation sequence into a target editing operation sequence of the JSON protocol; and sending the target editing operation sequence to the terminal so that the terminal updates the preview program according to the target editing operation sequence.

[0039] In an embodiment of the present application, a series of command protocols based on the JSON encoding format can be defined, including replacing files, incrementally updating a file, restarting a mini-program, establishing a connection, disconnecting a connection, etc.

[0040] JSON is a lightweight data exchange format that is easy for people to read and write, can exchange data between multiple languages, and is also easy for machines to parse and generate. The commands required in the embodiments of the present application are all defined based on the JSON encoding format to define some JSON format protocol fields. For example, after the obtained editing operation sequence is converted into a command protocol in JSON format, the update operation can be completed by incrementally updating the specified file that has been compiled according to the JSON format editing operation sequence.

[0041] You can establish a WebSocket server and forward the defined JSON command protocol to the WebSocket server to manage the WebSocket connection of the development tool and mobile preview. WebSocket is an extension based on the HTTP protocol. It provides a persistent, two-way communication channel, allowing the server to push data to the client in real time. The WebSocket handshake process generally includes the following steps: 1. The client sends a WebSocket handshake request; 2. The server responds to the handshake request; 3. The client verifies the handshake response; 4. Confirm that the handshake is successful and establish a WebSocket connection.

[0042] In the embodiment of the present application, a WebSocket server is established, and the defined JSON command protocol is forwarded to the WebSocket server for use by the WebSocket server. In addition, a WebSocket connection is established between the mobile terminal and the server through the WebSocket server.

[0043] After compiling the mini program for the first time in the development tool, you can inject a WebSocket client instance into the main process of the mini program base library to send and receive the JSON command protocol in step 1. After compiling the mini program that needs to be previewed on the mobile terminal for the first time in the development tool, establish a WebSocket connection between the development tool and the server through the WebSocket server, so that the compiled JSON command protocol can be received. After compiling the mini program that needs to be previewed on the mobile terminal for the first time in the development tool, establish a WebSocket connection between the development tool and the server through the WebSocket server, so that the compiled JSON command protocol can be sent.

[0044] By using development tools, according to the editing operation sequence corresponding to the information matrix, it is possible to sort out which files need to be modified and where (including insertion, deletion, matching and replacement operations), and convert these operation instructions into a command protocol in JSON format.

[0045] Specifically, the editing operation sequence can be converted into a target editing operation sequence of the JSON protocol, and the converted target editing operation sequence of the JSON protocol can be sent to the mobile terminal by using the established WebSocket connection, and the program can be updated by using the compiled incremental update specified file according to the target editing operation sequence in JSON format to complete the hot update operation of the program. The editing operation sequence is used to update the file through the JSON protocol, which means that the editing operation information is transmitted in a structured format. The JSON protocol is a universal data exchange format that is easy to parse and process. It provides an extensible way to transmit the editing operation sequence, making the process of updating files more flexible and maintainable. This method also facilitates integration with other systems or tools and improves interoperability.

[0046] It should be noted that the program update method provided in the embodiment of the present application can be executed by a program update device or a control module in the program update device for executing the program update method. In the embodiment of the present application, the program update device provided in the embodiment of the present application is described by taking the program update method executed by the program update device as an example.

[0047] Figure 2 is a schematic diagram of the structure of a program updating device according to an embodiment of the present application. Figure 2 As shown, the program updating apparatus 200 includes: an acquisition module 210 , a construction module 220 , a determination module 230 and an update module 240 .

[0048] The acquisition module 210 is used to obtain the difference fragment between the first code and the second code of the program under development when the first code is updated to the second code; the construction module 220 is used to construct an information matrix according to the operation information corresponding to the difference fragment, and the operation information indicates the operation direction of updating the first code to the second code; the determination module 230 is used to determine the editing operation sequence corresponding to the difference fragment according to the information matrix; the update module 240 is used to update the preview program corresponding to the program under development in the terminal according to the editing operation sequence.

[0049] In one implementation, the acquisition module 210 is used to perform incremental compilation on the second code to find out the target file with changes; and to find the difference segment between the first code and the second code from the target file.

[0050] In one implementation, the acquisition module 210 is further used to create a pattern string corresponding to the difference segment in the first code; create a target string corresponding to the difference segment in the second code; and initialize the information matrix according to the target string and the pattern string.

[0051] In one implementation, the construction module 220 is used to compare the first character at the jth position of the target string with the second character at the ith position of the pattern string; when the first character is equal to the second character, the value of the element in the i-th row and j-th column of the information matrix is ​​used as the operation information to fill in the element in the i+1-th row and j+1-th column of the information matrix; when the first character is not equal to the second character, the minimum value of the value of the element in the i-th row and j-th column, the value of the element in the i+1-th row and j+1-th column, and the value of the element in the i-th row and j+1-th column in the information matrix plus 1 is used as the operation information to fill in the element in the i+1-th row and j+1-th column of the information matrix, until the entire information matrix is ​​filled, wherein i and j are integers greater than or equal to 0.

[0052] In one implementation, the determination module 230 is used to trace back the information matrix; in the process of tracing back the information matrix, each editing operation is recorded according to the direction information to obtain the editing operation sequence.

[0053] In one implementation, the determination module 230 is used to record the direction information starting from the lower right corner of the information matrix and tracing back to the upper left corner according to the operation information corresponding to each value in the information matrix.

[0054] In one implementation, the update module 240 is used to convert the editing operation sequence into a target editing operation sequence of the JSON protocol; and send the target editing operation sequence to the terminal so that the terminal updates the previewed program according to the target editing operation sequence.

[0055] The program update device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0056] The program update device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0057] The program updating device provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented by the method embodiment are not described here.

[0058] Alternatively, if Figure 3 As shown, an embodiment of the present application further provides an electronic device 300, including a processor 301 and a memory 302, wherein the memory 302 stores a program or instruction that can be run on the processor 301, and the program or instruction is implemented when executed by the processor 301: when a first code of a program under development is updated to a second code, a difference fragment between the first code and the second code is obtained; according to operation information corresponding to the difference fragment, an information matrix is ​​constructed, and the operation information indicates the operation direction of updating the first code to the second code; according to the information matrix, an editing operation sequence corresponding to the difference fragment is determined; according to the editing operation sequence, the preview program corresponding to the program under development in the terminal is updated.

[0059] In one implementation, incremental compilation is performed on the second code to find out the target file with changes; and the difference segment between the first code and the second code is found in the target file.

[0060] In one implementation, before constructing the information matrix according to the operation information corresponding to the difference fragment, a pattern string corresponding to the difference fragment in the first code is created; a target string corresponding to the difference fragment in the second code is created; and the information matrix is ​​initialized according to the target string and the pattern string.

[0061] In one implementation, the first character at the jth position of the target string and the second character at the ith position of the pattern string are compared; when the first character is equal to the second character, the value of the element in the i-th row and j-th column of the information matrix is ​​used as the operation information to fill in the element in the i+1-th row and j+1-th column of the information matrix; when the first character is not equal to the second character, the minimum value of the value of the element in the i-th row and j-th column, the value of the element in the i+1-th row and j+1-th column, and the value of the element in the i-th row and j+1-th column of the information matrix plus 1 is used as the operation information to fill in the element in the i+1-th row and j+1-th column of the information matrix, until the entire information matrix is ​​filled, wherein i and j are integers greater than or equal to 0.

[0062] In one implementation, the information matrix is ​​backtracked; in the process of backtracking the information matrix, each editing operation is recorded according to the direction information to obtain the editing operation sequence.

[0063] In one implementation, based on the operation information corresponding to each value in the information matrix, the direction information is recorded starting from the lower right corner of the information matrix and tracing back to the upper left corner.

[0064] In one implementation, the editing operation sequence is converted into a target editing operation sequence of the JSON protocol; the target editing operation sequence is sent to the terminal, so that the terminal updates the previewed program according to the target editing operation sequence.

[0065] The specific execution steps can refer to the various steps of the above-mentioned program update method embodiment, and can achieve the same technical effect. To avoid repetition, they will not be repeated here.

[0066] It should be noted that the electronic devices in the embodiments of the present application include: servers, terminals or other devices except terminals.

[0067] The above electronic device structure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, the input unit may include a graphics processing unit (GPU) and a microphone, and the display unit may be configured with a display panel in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit includes a touch panel and at least one of other input devices. The touch panel is also called a touch screen. Other input devices may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0068] The memory can be used to store software programs and various data. The memory may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory may include a volatile memory or a non-volatile memory, or the memory may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DRRAM).

[0069] The processor may include one or more processing units; optionally, the processor integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor.

[0070] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned program update method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0071] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as ROM, RAM, magnetic disk or optical disk.

[0072] An embodiment of the present application also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the various processes of the above-mentioned program update method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0073] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0074] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0075] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A program updating method, characterized in that: include: When updating a first code of a program under development to a second code, obtaining a difference segment between the first code and the second code; constructing an information matrix according to operation information corresponding to the difference fragments, wherein the operation information indicates an operation direction in which the first code is updated to the second code; Determining, according to the information matrix, an editing operation sequence corresponding to the difference segment; According to the editing operation sequence, the preview program corresponding to the developing program in the terminal is updated.

2. The method according to claim 1, characterized in that The obtaining a difference segment between the first code and the second code includes: Incrementally compile the second code to find out the target files with changes; The difference segment between the first code and the second code is found in the target file.

3. The method according to claim 1, characterized in that Before constructing the information matrix according to the operation information corresponding to the difference fragments, the method further includes: Creating a pattern string corresponding to the difference segment in the first code; Creating a target string corresponding to the difference segment in the second code; Initialize the information matrix according to the target character string and the pattern character string.

4. The method according to claim 1, characterized in that: The step of constructing an information matrix according to the operation information corresponding to the difference fragments includes: Compare the first character at the jth position of the target string with the second character at the ith position of the pattern string; In the case where the first character is equal to the second character, filling the element in the i+1th row and j+1th column in the information matrix with the value of the element in the i-th row and j-th column in the information matrix as the operation information; When the first character is not equal to the second character, the minimum value of the element in the i-th row and j-th column, the value of the element in the i+1-th row and j-th column, and the value of the element in the i-th row and j+1-th column in the information matrix plus 1 is used as the operation information to fill the element in the i+1-th row and j+1-th column in the information matrix until the entire information matrix is ​​filled, wherein i and j are integers greater than or equal to 0.

5. The method according to claim 1, characterized in that: The step of determining the editing operation sequence corresponding to the difference segment according to the information matrix includes: Backtracking the information matrix; In the process of tracing back the information matrix, each editing operation is recorded according to the direction information to obtain the editing operation sequence.

6. The method according to claim 5, characterized in that The step of backtracking the information matrix comprises: According to the operation information corresponding to each value in the information matrix, starting from the lower right corner of the information matrix, the direction information is recorded back to the upper left corner.

7. The method according to claim 1, characterized in that The updating of the preview program corresponding to the program under development in the terminal according to the editing operation sequence includes: Convert the editing operation sequence into a target editing operation sequence of JSON protocol; The target editing operation sequence is sent to the terminal, so that the terminal updates the previewed program according to the target editing operation sequence.

8. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the program updating method according to any one of claims 1 to 7.

9. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the program updating method according to any one of claims 1 to 7 are implemented.

10. A computer program product, comprising a computer program stored on a non-transitory computer-readable storage medium, wherein the computer program comprises program instructions, and when the program instructions are executed by a computer, the computer is caused to execute the steps of the program updating method according to any one of claims 1 to 7.