Collaborative programming method, device, system, server and medium

By converting programming operations into collaborative information and handling conflicts on the server side, the real-time and accuracy issues in multi-user collaborative programming are solved, and real-time and accurate collaborative programming among multiple users is achieved.

CN113626010BActive Publication Date: 2025-09-05SHENZHEN DIANMAO TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110762446.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-06
Publication Date
2025-09-05
Estimated Expiration
2041-07-06

AI Technical Summary

Technical Problem

In the prior art, multi-user collaborative programming lacks real-time performance and accuracy, making it difficult to achieve real-time and accurate collaborative programming.

Method used

By converting programming operations into collaborative information of the target document and performing operation conversion processing on the server side, editing conflicts between different clients can be resolved and real-time and accurate collaborative programming can be achieved.

Benefits of technology

It improves the real-time performance and accuracy of collaborative programming, ensuring that programming operations between multiple users can be synchronized in real time and without conflicts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113626010B_ABST
    Figure CN113626010B_ABST
Patent Text Reader

Abstract

The present invention discloses a collaborative programming method, device, system, server and medium, including: obtaining a first programming operation on a target programming work; converting the first programming operation into first collaborative information for editing a target document, the target document being used to map the code data of the target programming work; when a sharing instruction is obtained, sending the first collaborative information to the server to instruct the server to send the first target collaborative information to the second client, the first target collaborative information being obtained by performing an operation conversion process on the first collaborative information to resolve editing conflicts between the first collaborative information and historical collaborative information. The code data of the programming work is mapped in real time through the document, and the programming operation is converted into collaborative information for editing the document during collaborative programming and distributed to each client, thereby realizing real-time sharing of programming operations, and resolving editing conflicts of the target document between different clients through operation conversion processing, thereby obtaining accurate and real-time collaborative programming results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet technology, and in particular to a collaborative programming method, device, system, server and medium. Background Art

[0002] With the development and progress of society and the rapid advancement of computer science, programming has become an increasingly important basic skill for modern people. People of all ages and backgrounds have a growing desire to learn and experience programming. Graphical block-based programming tools, specifically for children, have emerged in response to this changing era.

[0003] In current building block programming, different users often program independently on their own terminals. If multiple users need to jointly edit a work, they need to edit the work on their respective terminals and then export it and send it to a certain user for integration. The real-time performance is very poor. Even if different terminals jointly edit the work through collaborative communication, programming conflicts between different terminals are likely to occur. Therefore, it is still difficult to achieve real-time and accurate collaborative programming. Summary of the Invention

[0004] The purpose of the present invention is to provide a collaborative programming method, device, system, server and medium, aiming to solve the problem of insufficient real-time and accuracy of collaborative programming in the prior art.

[0005] A first aspect of the present invention provides a collaborative programming method, which is applied to a first client and includes: obtaining a first programming operation on a target programming work; converting the first programming operation into first collaborative information for editing a target document, wherein the target document is used to map the code data of the target programming work; when a sharing instruction is obtained, sending the first collaborative information to a server, wherein the sharing instruction is used to instruct the server to send the first target collaborative information to a second client that communicates collaboratively with the first client, wherein the first target collaborative information is obtained by operation conversion processing of the first collaborative information to resolve editing conflicts between the first collaborative information and historical collaborative information received by the server.

[0006] In some embodiments, before obtaining the first programming operation on the target programming work, the method further includes: converting the target programming work into a target document in a preset format according to the building structure of the target programming work and saving the document locally.

[0007] In some embodiments, converting the first programming operation into first collaborative information for editing the target document includes: based on the changes to the target programming work caused by the first programming operation, calling a preset conversion method to convert the first programming operation into a corresponding first document operation, the first document operation being used to correspondingly change the code data in the target document; generating the first collaborative information according to the first document operation, the first collaborative information being used to map the first programming operation to changes to the code data in the target document, or, based on the changes to the target programming work caused by an operation combination within a preset operation node, calling a preset conversion method to sequentially convert the first programming operations contained in the operation combination into corresponding first document operations, the first document operation being used to correspondingly change the code data in the target document; generating unit collaborative information according to the first document operation, and combining the unit collaborative information in a conversion order to obtain the first collaborative information, the first collaborative information being used to map the operation combination to changes to the code data in the target document.

[0008] In some embodiments, when the target document is a JSON document with a tree structure, the first document operation includes a subtree picking operation, a subtree inserting operation, and a subtree object editing operation.

[0009] In some embodiments, when a sharing instruction is obtained, the first collaborative information is sent to the server, including: when the sharing instruction is obtained, the collaborative status of the first client is confirmed, the collaborative status includes a synchronized state, a waiting for confirmation state, and a buffered waiting state, and the sharing instruction carries the identifier of the second client; if the collaborative status of the first client is a synchronized state, the first collaborative information is sent to the server, and the sharing instruction is used to instruct the server to send the first target collaborative information to the second client determined by the identifier.

[0010] In some embodiments, the method further includes: updating the collaborative state of the first client after sending the first collaborative information to the server, and updating the collaborative state of the first client upon receiving instruction confirmation information returned by the server.

[0011] In some embodiments, the method further includes: obtaining a collaborative creation instruction, the collaborative creation instruction being used to instruct the first client to establish collaborative communication with the second client; creating a target programming work according to the collaborative creation instruction, and sending the target programming work to the server.

[0012] In some embodiments, the method also includes: receiving second target collaborative information sent by the server, where the second target collaborative information is obtained by operation conversion processing of the second collaborative information sent by the second client to resolve the editing conflict between the second collaborative information and the historical collaborative information received by the server; editing the target document according to the second target collaborative information; and displaying the collaborative programming result of the target programming work obtained by mapping the target document after editing the target document with the second target collaborative information.

[0013] In some embodiments, the method also includes: restoring the second target collaborative information into a second target programming operation for changing the target programming work; when there is a conflict between the second target programming operation and the first programming operation obtained locally, conflict handling is performed on the second target programming operation and the first programming operation according to a preset operation priority sorting.

[0014] A second aspect of an embodiment of the present application provides a collaborative programming method, which is applied to a second client, and the second client communicates collaboratively with the first client. The method includes: receiving first target collaborative information sent by a server, where the first target collaborative information is obtained by operation conversion processing of the first collaborative information sent by the first client, so as to resolve editing conflicts between the first collaborative information and historical collaborative information received by the server; editing the target document according to the first target collaborative information, where the target document is used to map code data of a target programming work; restoring the first target collaborative information to a first target programming operation for changing the target programming work; and displaying the collaborative programming result after the target programming work is changed by the first target programming operation.

[0015] In some embodiments, before receiving the first target collaboration information sent by the server, the method further includes: converting the target programming work into a target document in a preset format according to the construction structure of the target programming work and saving the document locally.

[0016] In some embodiments, the editing of the target document according to the first target collaborative information includes: confirming the collaborative status of the second client, the collaborative status including the synchronized status, the waiting for confirmation status and the buffered waiting status; if the collaborative status of the second client is the synchronized status, editing the target document according to the first target collaborative information; if the collaborative status of the second client is the waiting for confirmation status or the buffered waiting status, performing a secondary operation conversion processing on the first target collaborative information, and editing the target document according to the first target collaborative information after the secondary operation conversion processing.

[0017] In some embodiments, the restoring of the first target collaborative information to a first target programming operation for changing the target programming work includes: parsing the first target collaborative information according to a preset parsing class library, and obtaining a first target document operation for changing the code data contained in the first target collaborative information; based on the change of the code data by the first target document operation, calling a preset conversion method to restore the first target document operation to a first target programming operation, the first target programming operation being used to map the first target collaborative information to a change to the building structure of the target programming work, or decomposing the first target collaborative information to obtain a plurality of unit collaborative information; parsing the unit collaborative information in turn according to a preset parsing class library, and obtaining the first target document operation on the code data contained in each unit collaborative information; based on the change of the code data by the first target document operation, calling a preset conversion method to restore the first target document operation to a first target programming operation, the first target programming operation being used to map the first target collaborative information to a change to the building structure of the target programming work.

[0018] In some embodiments, when the target document is a tree-structured JSON document, the first target document operation includes a subtree picking operation, a subtree inserting operation, and a subtree object editing operation.

[0019] In some embodiments, the method further includes: when there is a conflict between the first target programming operation and a locally acquired second programming operation, performing conflict resolution on the second programming operation and the first target programming operation according to a preset operation priority ranking.

[0020] In some embodiments, the method further includes: creating a target programming work, and sending the target programming work to the server,

[0021] Alternatively, the target programming work is received from the server.

[0022] In some embodiments, the method also includes: obtaining a second programming operation on the target programming work; converting the second programming operation into second collaborative information for editing the target document; when a sharing instruction is obtained, sending the second collaborative information to the server, and the sharing instruction is used to instruct the server to send second target collaborative information to the first client, wherein the second target collaborative information is obtained by operation conversion processing of the second collaborative information to resolve the editing conflict between the second collaborative information and the historical collaborative information received by the server.

[0023] A third aspect of an embodiment of the present application provides a collaborative programming method, which is applied to a server and includes: receiving first collaborative information and a sharing instruction sent by a first client, wherein the first collaborative information is used to edit a target document mapping a target programming work, and the sharing instruction carries an identifier of a second client; performing an operation conversion process on the first collaborative information according to historical collaborative information in a received record to obtain first target collaborative information so as to resolve editing conflicts between the first collaborative information and the historical collaborative information; and sending the first target collaborative information to the second client determined by the identifier according to the instructions of the sharing instruction.

[0024] In some embodiments, before receiving the first collaboration information and sharing instruction sent by the first client, the method further includes: converting the target programming work into a target document in a preset format according to the building structure of the target programming work and distributing it to the first client and the second client.

[0025] In some embodiments, the first target collaborative information is obtained after the first collaborative information is operationally converted according to the historical collaborative information in the receiving record, including: obtaining the instruction reception time of the historical collaborative information and the first collaborative information, and sorting the instruction reception time, and the historical collaborative information comes from the first client or the second client; when there is a conflict between the first collaborative information and the historical collaborative information, the first collaborative information is operationally converted according to the preset conversion rules based on the sorting of the instruction reception time to resolve the editing conflict between the first collaborative information and the historical collaborative information.

[0026] In some embodiments, after performing operational conversion processing on the first collaborative information according to the historical collaborative information in the reception record to obtain the first target collaborative information, the method further includes: sending instruction confirmation information to the first client.

[0027] An embodiment of the present application provides a collaborative programming device, which has the function of implementing the method in the above-mentioned first aspect and its various implementation methods.

[0028] An embodiment of the present application provides a collaborative programming device, which has the function of implementing the method in the above-mentioned second aspect and its various implementation methods.

[0029] An embodiment of the present application provides a collaborative programming device, which has the function of implementing the method in the above-mentioned third aspect and its various implementation methods.

[0030] A server, comprising:

[0031] a receiving module, configured to receive first collaboration information and a sharing instruction sent by a first client, wherein the first collaboration information is used to edit a target document mapped to the target programming work, and the sharing instruction carries an identifier of a second client;

[0032] an operation conversion module, configured to perform an operation conversion process on the first collaborative information according to the historical collaborative information in the received record to obtain first target collaborative information, so as to resolve an editing conflict between the first collaborative information and the historical collaborative information;

[0033] A sending module is used to send the first target collaboration information to the second client determined by the identifier according to the instruction of the sharing instruction.

[0034] A collaborative programming system comprising at least one processor; and

[0035] a memory communicatively connected to the at least one processor; wherein,

[0036] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the above-mentioned collaborative programming method.

[0037] Another embodiment of the present invention further provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the one or more processors can execute the above-mentioned collaborative programming method.

[0038] Beneficial effects: The present invention discloses a collaborative programming method, device, system, server and medium. Compared with the existing technology, the code data of the target programming work is mapped in real time through the target document. During collaborative programming, the programming operations on the target programming work are converted into collaborative information for editing the target document and distributed to each client to achieve real-time sharing of programming operations, thereby improving the real-time performance of collaborative programming. In addition, the editing conflicts of the target document by different clients are resolved through operation conversion processing, thereby improving the accuracy of collaborative programming and obtaining real-time and accurate collaborative programming results. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A flowchart of a collaborative programming method provided by an embodiment of the present invention;

[0040] Figure 2 Another flow chart of the collaborative programming method provided by an embodiment of the present invention;

[0041] Figure 3 Another flow chart of the collaborative programming method provided by an embodiment of the present invention;

[0042] Figure 4 Another flow chart of the collaborative programming method provided by an embodiment of the present invention;

[0043] Figure 5 Another flow chart of the collaborative programming method provided by an embodiment of the present invention;

[0044] Figure 6 Another flow chart of the collaborative programming method provided by an embodiment of the present invention;

[0045] Figure 7 A schematic diagram of the structure of an operation conversion model in the collaborative programming method provided by an embodiment of the present invention;

[0046] Figure 8 A schematic diagram of interaction between different terminals in the collaborative programming method provided by an embodiment of the present invention;

[0047] Figure 9 A schematic diagram of a functional module of a collaborative programming device provided by an embodiment of the present invention;

[0048] Figure 10 A schematic diagram of another functional module of the collaborative programming device provided by an embodiment of the present invention;

[0049] Figure 11 A schematic diagram of a functional module of a server provided in an embodiment of the present invention;

[0050] Figure 12 A schematic diagram of the hardware structure of the collaborative programming system provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0051] To make the objectives, technical solutions, and effects of the present invention more clear and distinct, the present invention is further described in detail below. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the present invention and are not intended to limit the present invention. The embodiments of the present invention are described below with reference to the accompanying drawings.

[0052] Embodiments of the present invention provide a collaborative programming method applied to a system comprising multiple terminal devices, a network, and a server to implement collaborative programming between multiple terminal devices. The network is the medium that provides a communication link between the terminal devices and the server, and may include various connection types, such as wired or wireless communication links or fiber optic cables. The terminal devices may be various electronic devices with display screens and web browsing support, including but not limited to smartphones, tablet computers, portable computers, and desktop servers.

[0053] Users with different identities, such as teacher users, student users, etc., can log in on their respective terminal devices through their respective accounts and use the building block programming IDE (integrated development environment) to perform collaborative programming operations. That is, the IDE is a building block programming client pre-installed on each terminal, which integrates, for example, a code editor, compiler, interpreter, debugger, etc. to realize the building block code compilation, debugging and execution processes.

[0054] Specifically, the multiple terminal devices can be at least two terminal devices, and the clients on each terminal device can communicate collaboratively with each other through the server. For example, a first client and each second client can communicate collaboratively through the server using the WebSocket protocol to achieve collaborative programming between the first client and each second client. Different users can log in and use the clients on their respective terminal devices to collaboratively program the same target programming work. During the collaborative programming process, the programming operations of each client participating in the collaborative communication will be synchronized to the other clients, and the programming results of the target programming work will be synchronously displayed on the other clients, thereby achieving the purpose of collaborative programming.

[0055] Please refer to the following for details: Figure 1 , Figure 1 This is a flow chart of an embodiment of the collaborative programming method provided by the present invention. The method is applied to a first client and introduces the collaborative programming method from the perspective of the first client logged in and used by a user who actively inputs programming operations.

[0056] like Figure 1 As shown, the method specifically includes the following steps:

[0057] S101: Acquire a first programming operation on a target programming work.

[0058] In this embodiment, after the user logs in to the first client through the first account, the user can input a first programming operation on the target programming work in the graphical programming interface on the first client, and obtain the first programming operation by detecting touch events, mouse events, keyboard input events, etc., wherein the target programming work can be newly created on the first client. At this time, the first client sends the newly created target programming work to each second client through the server to realize flexible addition of target programming works; or it can also be saved in the shared space of the server, and all clients maintaining collaborative communication can access the data in the shared space. The first client and each second client can download the target programming work from the shared space to the local, and then the user can perform collaborative programming operations to realize centralized and efficient distribution of target programming works.

[0059] Specifically, the first programming operation uses the graphical elements in the target programming work as the operation object, such as building block code blocks, execution roles, etc., which can be specifically move operations, delete operations, drag operations, add operations, splicing operations, etc. This embodiment does not limit this, thereby realizing graphical programming operations on building block code blocks or execution roles. The building block code blocks are block structures used to replace code fragments in graphical programming. Each building block code block encapsulates code that triggers corresponding events or implements corresponding functions. The execution role is the object of the running event when the building block code block is run, that is, the event corresponding to the building block code block is executed on the execution role and the corresponding execution result is displayed. By performing visual programming operations on building block code blocks and execution roles, a convenient and efficient programming process can be achieved.

[0060] Furthermore, if Figure 2 As shown, before step S101, the method further includes the steps of:

[0061] S104: Convert the target programming work into a target document in a preset format according to the construction structure of the target programming work and save the document locally.

[0062] In this embodiment, after the target programming work is newly created or downloaded on the first client, the target programming work is converted into a target document in a preset format based on the building structure of the target programming work and saved locally. That is, in this embodiment, the conversion operation of converting the target programming work into the target document is performed on the first client. Of course, in other embodiments, the converted target document can also be downloaded from, for example, a server, and this embodiment is not limited to this. Since during the block programming operation, the user operates not on a document but on a block code block that encapsulates the corresponding logic code, and there are interactive relationships such as dependencies, inclusions, and connections between the block code blocks, due to the complexity of the block code blocks, traditional graphical collaborative editing cannot ensure accurate collaborative processing of programming operations on the block code blocks. Therefore, in this embodiment, the target programming work is first converted into the target document in a preset format based on the building structure of the target programming work, thereby converting the graphical target programming work into an accurate target document containing the corresponding code data. Subsequent programming operations on the target programming work are correspondingly converted into editing operations on the target document, so that programming conflicts on different clients can be resolved based on document editing, thereby improving the accuracy of block programming collaboration.

[0063] Specifically, the target programming work can be converted into a target document in JSON (javascript object notation) format, for example, the building structure of the building block code blocks in the target programming work is obtained, the interaction relationship between each sub-building block is determined, such as connection, inclusion, sequential dependency, etc., and the building block data of each sub-building block is obtained. The building block data is the code data of the corresponding function encapsulated in each sub-building block, for example, it can be JavaScript code or other code, etc. According to the interaction relationship between each sub-building block and the building block data, the target programming work is converted into a JSON document of a preset structure. Specifically, a tree-structured JSON document can be used to more clearly reflect the hierarchical relationship between the building block code blocks. JSON is a lightweight data exchange format that uses a text format that is completely independent of the programming language to store and represent data. The concise and clear hierarchical structure makes JSON an ideal data exchange language, which is easier for people to read and write, and is also easy for machines to parse and generate, and effectively improves network transmission efficiency. It is understandable that the target document in JSON format can save the code data of the target programming work through a preset structure, such as using a tree-structured JSON document to adapt to the parsing and operation conversion rules in the preset parsing library to resolve document editing conflicts.

[0064] S102: Convert the first programming operation into first collaborative information for editing a target document, where the target document is used to map code data of the target programming work.

[0065] In this embodiment, after the first client obtains the first programming operation on the target programming work, the first programming operation is converted into the first collaborative information for editing the target document. The target document is used to map the code data of the target programming work, that is, the first collaborative information is an operation instruction applied to the document data. Since the target document stores code data that is mapped in real time to the building structure of the target programming work, changes to the target programming work will cause corresponding changes to the target document. Similarly, changes to the target document will also cause changes to the target programming work. The two always maintain a real-time mapping relationship. When performing collaborative programming, the first programming operation is converted into the first collaborative information to reflect the changes to the target programming work through changes in the code data, so that the graphical programming operation can be converted into an accurate document editing operation, which can avoid the collaborative programming tradition caused by the interactive relationship between the building block code blocks of the operation.

[0066] Specifically, converting the first programming operation into first collaborative information for editing the target document includes:

[0067] Based on the modification of the target programming work by the first programming operation, calling a preset conversion method to convert the first programming operation into a corresponding first document operation, where the first document operation is used to modify code data in the target document accordingly;

[0068] generating the first coordination information according to the first file operation, wherein the first coordination information is used to map the first programming operation to a change to code data in the target file;

[0069] or,

[0070] Based on the changes made to the target programming work by the operation combination within the preset operation node, calling a preset conversion method to sequentially convert the first programming operations included in the operation combination into corresponding first document operations, where the first document operations are used to correspondingly change the code data in the target document;

[0071] Unit collaboration information is generated according to the first document operation, and the first collaboration information is obtained by combining the unit collaboration information in a conversion order. The first collaboration information is used to map the operation combination into a change to the code data in the target document.

[0072] In this embodiment, when the first client generates the corresponding first collaborative information based on the first programming operation, based on the changes to the target programming work caused by the single first programming operation, such as deleting a building block code block or moving a building block code block, etc., the preset conversion method can be directly called to convert between the programming operation and the collaborative information, and the single first programming operation obtained is converted into the corresponding first document operation. The first document operation is a preset basic operation for changing the code data in the target document. A programming operation can be converted into one or more more basic basic operations. The basic operations may include different operation types, thereby reducing the atomicity of the collaborative programming operation and facilitating subsequent conflict resolution. That is, the first programming operation input by the user for the target programming work can be converted into the first collaborative information including one or more first document operations to make corresponding changes to the target document. When there are multiple first document operations, they are combined to generate the first collaborative information, and the first programming operation is mapped to the change to the code data in the target document through the first collaborative information.

[0073] Alternatively, if there is an input scenario of an operation combination during collaborative programming, the changes to the target programming work are converted based on the operation combination within the preset operation node. Specifically, the operation combination refers to a programming operation consisting of at least two first programming operations with sequential dependencies. The preset operation node can be determined based on the combination instruction input by the user. For example, the user clicks the preset "Combination" button on the first client before inputting the operation combination. Then, all programming operations before detecting that the user clicks the "Combination" button again are regarded as an operation combination for conversion and generation of collaborative information. Alternatively, a method such as a preset time can be used to determine the operation node. When the user clicks the "Combination" button, the timing starts, and when the timing reaches the preset time (for example, 30 seconds, etc.), the timing ends. All first programming operations obtained within the preset time are regarded as the operation combination, that is, the user needs to complete the input of the operation combination within the preset time. Of course, other methods can also be used in other embodiments, and this embodiment does not limit this.

[0074] Based on the changes to the target programming work made by the operation combination, the preset conversion method can be called to sequentially convert the first programming operation contained in the operation combination into the corresponding first document operation. Similarly, the first document operation is a preset basic document operation for changing the code data in the target document. According to the first document operation, a number of unit collaborative information corresponding to the first programming operation is generated, and then the obtained several unit collaborative information are combined in the conversion order to obtain the first collaborative information. At this time, the operation combination is mapped to the change to the code data in the target document through the first collaborative information. Since there may be a sequence dependency on the operation of the building blocks in the building block programming operation, if the programming operation combination with sequence dependency is converted into the corresponding collaborative information separately, it may cause errors in the subsequent conflict handling. Therefore, in order to avoid this situation, in this embodiment, the operation combination in the preset operation node is converted in sequence and then combined to generate the first collaborative information to prevent the programming operation combination with sequence dependency from being queued by other irrelevant operations, resulting in collaborative programming errors.

[0075] During the specific conversion, the first programming operation is converted through the basic first document operation, that is, the generated first collaborative information only contains one or more first document operations, and the first document operation obtained by combining different operation types implements the corresponding first programming operation. Taking the target document as a tree-structured JSON document as an example, the first document operation includes a subtree picking operation, a subtree inserting operation, and a subtree object editing operation, that is, when performing conversion between programming operations and collaborative information, a programming operation can be converted into a combination of first document operations containing at least one of the above-mentioned operation types. The changes of the programming operation to the programming work are combined and mapped through the preset basic operation types, thereby converting the programming operation into an atomic operation with higher atomicity (meaning "one or a series of operations that cannot be interrupted"), which is conducive to accurately handling editing conflicts when editing the target document and realizing accurate collaborative programming.

[0076] S103: When a sharing instruction is obtained, the first collaborative information is sent to the server, where the sharing instruction is used to instruct the server to send the first target collaborative information to the second client communicating with the first client.

[0077] The first target collaborative information is obtained by performing an operation conversion process on the first collaborative information to resolve an editing conflict between the first collaborative information and historical collaborative information received by the server.

[0078] In this embodiment, after the first programming operation is converted into the first collaborative information, the user can enter a sharing instruction by clicking a preset button such as "Share" on the graphical programming interface. After obtaining the sharing instruction, the converted first collaborative information is sent to the server. For example, when the user is performing collaborative programming, after entering the first programming operation on the target programming work, the user can simply click the "Share" button to share the operation. At this time, the first collaborative information converted from the first programming operation is sent to the server. At the same time, the sharing instruction instructs the server to send the first target collaborative information to the designated second client to realize collaborative sharing of programming operations, which simplifies the operation steps and saves a lot of time when multiple people jointly edit works.

[0079] Among them, the first target collaborative information is obtained by the operation conversion processing of the first collaborative information to resolve the editing conflict between the first collaborative information and the historical collaborative information received by the server. Since there may be an instruction conflict between the first collaborative information currently sent to the server and the historical collaborative information received by the server, resulting in different programming results on different clients, it is necessary to send the first target collaborative information obtained after the operation conversion processing to the second client to resolve the editing conflict when different clients edit the same target programming work, and then display the programming result corresponding to the first target collaborative information on the second client. Since the first target collaborative information has resolved the editing conflict, the programming result displayed on the second client is the same as the execution result of the first programming operation on the first client, realizing real-time and accurate collaborative programming.

[0080] Optionally, when the sharing instruction is obtained, sending the first collaborative information to the server includes:

[0081] When a sharing instruction is obtained, the collaborative state of the first client is confirmed, where the collaborative state includes a synchronized state, a waiting state for confirmation, and a buffered waiting state. The sharing instruction carries an identifier of the second client.

[0082] If the collaboration state of the first client is a synchronized state, the first collaboration information is sent to the server, and the server is instructed to send the first target collaboration information to the second client determined by the identifier through the sharing instruction.

[0083] In this embodiment, when a sharing instruction carrying the identification of the second client is obtained, the first collaborative information is not sent to the server immediately, but the current collaborative status of the first client is confirmed first. The specific collaborative status includes a synchronized state, a waiting for confirmation state, and a buffered waiting state. The synchronized state indicates that there is no collaborative information waiting to be sent locally on the client, and confirmation information has been received for the collaborative information that has been sent; the waiting for confirmation state indicates that there is no collaborative information waiting to be sent locally on the client, and confirmation information for the collaborative information that has been sent is being waited for; the buffered waiting state indicates that there is collaborative information waiting to be sent locally on the client, and confirmation information for the collaborative information that has been sent is being waited for. The current instruction sending status of the client is clearly distinguished by different collaborative states, so as to achieve more orderly and accurate collaborative programming and ensure the smooth progress of collaborative programming.

[0084] After confirming the current collaborative status of the first client, if it is currently in a synchronized state, it means that all previously sent collaborative information has received confirmation information and been synchronized, and there is no other collaborative information waiting to be sent, which means that the first collaborative information at this time is the latest collaborative information to be sent. Therefore, the first collaborative information and sharing instructions are sent to the server that is connected to the first client. The sharing instruction instructs the server to send the first target collaborative information to the second client determined by the identifier. Specifically, the identifier can be the address information of the second client, such as an IP address, or it can be the ID information of the user currently using the second client, etc., so that the first target collaborative information obtained after operation conversion processing is sent to the specified second client through the server, ensuring the accurate distribution and sharing of collaborative information in collaborative programming.

[0085] The collaborative programming method further includes:

[0086] The collaborative state of the first client is updated after the first collaborative information is sent to the server, and the collaborative state of the first client is updated when instruction confirmation information returned by the server is received.

[0087] In this embodiment, the collaborative status of the first client is updated in real time based on the sending and confirmation status of its collaborative information. When the first client sends the first collaborative information to the server, it indicates that the status before sending is the synchronized status, then it is updated to the waiting for confirmation status after sending, indicating that the collaborative information has been sent but no confirmation information has been received yet; and the first client also updates the corresponding collaborative status when receiving the instruction confirmation information returned by the server. Specifically, if the first client is in the synchronized status before receiving the instruction confirmation information, since there should be no waiting instruction confirmation information at present, an error is thrown when the instruction confirmation information is received; if the first client is in the waiting for confirmation status before receiving the instruction confirmation information, there is no other collaborative information to be sent locally at this time, so it is updated to the synchronized status when the instruction confirmation information is received; if the first client is in the buffered waiting status before receiving the instruction confirmation information, there is other collaborative information to be sent at this time, so the cached collaborative information is sent to the server. If there is no other collaborative information to be sent locally, the status is updated to the waiting for confirmation status. If there is other collaborative information to be sent locally, the buffered waiting status is maintained. The collaborative status of the first client is updated accordingly according to the sending and confirmation of the collaborative information, ensuring that each collaborative information can be sent to the server in order for sharing, thereby achieving accurate and orderly collaborative information sending and sharing.

[0088] The collaborative programming method further includes:

[0089] Obtaining a collaborative creation instruction, where the collaborative creation instruction is used to instruct the first client to establish collaborative communication with the second client;

[0090] A target programming work is created according to the collaborative creation instruction, and the target programming work is sent to the server.

[0091] In this embodiment, the user can choose whether to perform collaborative programming according to programming needs. When collaborative programming is required, a collaborative creation instruction can be input to instruct the first client to establish collaborative communication with the specified second client. For example, the user can click the "Create Collaborative Project" instruction and choose to invite other users to join the collaborative programming based on further collaborative object guidance information. The corresponding second client is determined based on the ID information of other users, and collaborative communication is established between the server and the determined second client. Specifically, a socket connection can be established to achieve collaborative communication. Afterwards, a target programming work is created on the first client based on further project creation guidance information, and the target programming work is sent to the server, so that the server distributes the target programming work to each second client, thereby achieving flexible creation and sharing of the target programming work.

[0092] The collaborative programming method further includes:

[0093] receiving second target collaborative information sent by the server, where the second target collaborative information is obtained by operation conversion processing of the second collaborative information sent by the second client, so as to resolve an editing conflict between the second collaborative information and the historical collaborative information received by the server;

[0094] Editing the target document according to the second target collaborative information;

[0095] The collaborative programming result of the target programming work obtained by mapping the target document after editing the target document using the second target collaborative information is displayed.

[0096] In this embodiment, the user can input a second programming operation in the graphical programming interface on the second client, and perform block programming on the target programming work through the second programming operation. Similar to the first collaborative information, the second programming operation is converted into second collaborative information for editing the target document. The first client receives the second target collaborative information sent by the server after the operation conversion processing of the second collaborative information. At this time, the second target collaborative information has resolved the editing conflict, ensuring the accuracy of the collaborative information received by the first client. Similarly, the generation method of the second collaborative information is the same as the generation method of the first collaborative information. The generation method of the second target collaborative information is the same as the generation method of the first target collaborative information, which will not be repeated here.

[0097] That is, the first client can not only act as a sender to send the first collaborative information to each second client, but also act as a receiver to receive the second target collaborative information generated by each second client based on the second programming operation and obtained after the operation conversion processing. After that, the first client locally edits the target document according to the second target collaborative information to map the changes to the code data caused by the second programming operation after the operation conversion processing, thereby displaying the collaborative programming result without editing conflicts obtained after the second target collaborative information is edited on the local interface of the first client. This enables multiple clients to collaborate on the same target programming work, thereby enhancing the information interoperability and programming efficiency between users of different clients.

[0098] Optionally, when the first client serves as the receiving end, the collaborative programming method further includes:

[0099] restoring the second target collaborative information into a second target programming operation for modifying the target programming work;

[0100] When there is a conflict between the second target programming operation and the locally acquired first programming operation, conflict resolution is performed on the second target programming operation and the first programming operation according to a preset operation priority ranking.

[0101] In this embodiment, when executing the programming operation mapped by the second target collaborative information, the second target collaborative information is first restored to obtain the second target programming operation used to change the building structure of the target programming work. It can be understood that the restoration process is opposite to the generation process of the first collaborative information and the second collaborative information, thereby mapping the changes to the code data in the target document in real time to changes to the building structure of the target programming work. At the same time, since the second target collaborative information sent by the server can only be converted and processed according to the historical collaborative information received to resolve the conflict, if there is collaborative information that has not been sent locally at the receiving end, the restored second target programming operation may conflict with the first programming operation locally obtained by the first client, such as the first programming operation that has not yet been converted to generate collaborative information, etc. At this time, if the restored second target programming operation is directly applied to the target programming work of the first client, a programming conflict or even a client crash will occur. Therefore, in order to avoid this situation, the conflicting second target programming operation and the first programming operation are handled according to the preset operation priority. The specific operation priority can be sorted by time, such as obtaining the time when the server receives the second collaborative information and the input time of the local first programming operation. The earlier the time, the higher the priority, etc. Of course, other priority sorting rules can also be used. This embodiment does not limit this. When handling specific conflicts, the programming operation with a higher operation priority is executed first, and then the programming operation with a lower operation priority is executed, to ensure that there will be no operation conflict at the client operation level, thereby improving the accuracy of collaborative programming.

[0102] The above mainly introduces the collaborative programming method from the perspective of the first client logged in by the user who actively inputs programming operations. The following will introduce the collaborative programming method from the perspective of the second client logged in by the user who passively performs synchronous programming operations.

[0103] See also Figure 3 , Figure 3 This is a flowchart of an embodiment of the collaborative programming method provided by the present invention. The method is applied to a second client, and the second client maintains collaborative communication with the first client.

[0104] like Figure 3 As shown, the method specifically includes the following steps:

[0105] S301. Receive first target collaborative information sent by a server, where the first target collaborative information is obtained by operation conversion processing of the first collaborative information sent by the first client to resolve editing conflicts between the first collaborative information and historical collaborative information received by the server.

[0106] In this embodiment, similar to the first client, the user can log in to the second client through the second account, and receive the first target collaborative information sent by the server on the second client, wherein the first target collaborative information is the first collaborative information sent by the first client after the operation conversion processing, and the first collaborative information is converted according to the first programming operation of the target programming work input on the first client, that is, at this time, the second client serves as the receiving end in the collaborative communication, and receives the first target collaborative information distributed by the server after the operation conversion processing of the first collaborative information. At this time, the first target collaborative information has resolved the editing conflict, so as to achieve conflict-free and accurate editing of the target document through the first target collaborative information on the second client, and achieve efficient and accurate collaborative information transmission. Specifically, the conversion and generation method of the first collaborative information has been described in detail in the method executed by the first client, and will not be repeated here.

[0107] The collaborative programming method further includes:

[0108] creating a target programming work and sending the target programming work to the server,

[0109] or,

[0110] Receive the target programming work sent by the server.

[0111] In this embodiment, the target programming work can be newly created on the second client. At this time, the second client sends the newly created target programming work to the server, which sends it to the first client through the server and then receives the first target collaborative information, thereby realizing flexible addition of target programming works; or the target programming work can also be stored in the shared space of the server. All clients maintaining collaborative communication can access the data in the shared space. The second client can download the target programming work from the shared space to the local computer, and then receive the first target collaborative information to perform collaborative programming operations, thereby realizing centralized and efficient distribution of target programming works.

[0112] Furthermore, if Figure 4 As shown, before step S301, the method further includes the steps of:

[0113] S305: Convert the target programming work into a target document in a preset format according to the construction structure of the target programming work and save the document locally.

[0114] In this embodiment, after the target programming work is newly created or downloaded on the second client, the target programming work is converted into a target document in a preset format according to the construction structure of the target programming work and saved locally. That is to say, in this embodiment, the conversion operation of converting the target programming work into the target document is performed on the second client. Of course, in other embodiments, the converted target document can also be downloaded from, for example, a server, and this embodiment does not limit this. Similarly, when the user inputs the first programming operation on the first client, the user operates not a document but a building block code block encapsulating the corresponding logical code. There are interactive relationships such as dependency, inclusion, connection, etc. between the building block code blocks. Based on the complexity of the building block code blocks, traditional graphical collaborative editing cannot ensure accurate collaborative processing of the programming operations of the building block code blocks. Therefore, in this embodiment, the target programming work is first converted into the target document of a preset format according to the building block building structure of the target programming work, thereby converting the graphical target programming work into an accurate target document containing corresponding code data. The code data in the target document is mapped in real time to the building structure of the target programming work. Changes to the target document can correspond to changes to the target programming work. Therefore, on the second client, during collaborative programming, the target document can be edited according to the first target collaborative information and then restored to obtain the corresponding programming operation, thereby realizing collaborative programming. Preferably, the target document adopts JSON format, and the target document in JSON format saves the code data of the target programming work through a preset structure. For example, a tree-structured JSON document is adopted to adapt to the parsing and conflict handling rules in the preset parsing library to achieve the resolution of document editing conflicts. The conversion and generation method of the target document has been described in detail in the method executed by the first client and will not be repeated here.

[0115] S302. Edit the target document according to the first target collaborative information, where the target document is used to map code data of the target programming work.

[0116] In this embodiment, after the second client receives the first target collaborative information, the first target collaborative information received at this time has resolved the editing conflict with the historical collaborative information received by the server, so it is applied to the local target document of the second client, and the corresponding editing operation is performed on the target document through the first target collaborative information to realize document collaborative editing. The target code document is used to map the code data of the target programming work to reflect the changes to the code data caused by the first programming operation after the operation conversion processing in real time, so as to realize collaborative editing at the document data level of the target programming work.

[0117] Furthermore, the editing of the target document according to the first target collaborative information includes:

[0118] Confirming the collaborative state of the second client, the collaborative state including a synchronized state, a waiting for confirmation state, and a buffered waiting state;

[0119] If the collaboration state of the second client is synchronized, editing the target document according to the first target collaboration information;

[0120] If the collaboration state of the second client is a waiting state for confirmation or a buffered waiting state, a secondary operation conversion process is performed on the first target collaboration information, and the target document is edited according to the first target collaboration information after the secondary operation conversion process.

[0121] In this embodiment, similarly, the second client also has different collaborative states at different times, so as to achieve more orderly and accurate collaborative programming. The meaning of each collaborative state has been described in detail in the method executed by the first client and will not be repeated here. If the second client is currently in a synchronized state, it means that all previously sent collaborative information has received confirmation information for synchronization, and there is no other collaborative information waiting to be sent. At this time, the first target collaborative information after the operation conversion process is directly applied to the target document to achieve collaborative editing at the building block code document level.

[0122] If the second client is currently in a waiting for confirmation state or a buffered waiting state, it means that the second client has collaborative information that has been sent but has not yet received the instruction confirmation information returned by the server, or there is collaborative information that has been sent but has not yet received the instruction confirmation information returned by the server and collaborative information to be sent. That is, although the first target collaborative information received at this time has resolved the collaborative document editing conflicts between multiple clients on the server, it may conflict with the collaborative information that has not been confirmed and sent on the second client. Therefore, it is necessary to perform secondary operation conversion processing on the received first target collaborative information on the second client to resolve the document editing conflict on the local client, and edit the target document according to the first target collaborative information after the secondary operation conversion processing to ensure the accuracy of collaborative editing at the document data level.

[0123] Specifically, operation transformation processing refers to a method of maintaining the consistency of different data copies in multi-terminal collaboration through the OT (operation transformation) algorithm, so that different terminals can adjust the operations according to the different operation orders received by the server to maintain data consistency, and achieve efficient, real-time and accurate collaborative editing. Since OT-based collaborative editing is completely real-time, there will be no editing delay. At the same time, the conversion method of OT processing can pre-define different conversion functions as operation conversion rules according to different application scenarios to adapt to the operation conversion needs of different editing scenarios. It is an existing technology and will not be elaborated here. Through operation conversion processing, it is ensured that when there is a conflict in the collaborative information sent to the server by different clients, or when there is an editing conflict between the collaborative information received by the client and the collaborative information that has not been sent locally, operation conversion processing can be performed accurately and flexibly to resolve the conflict, thereby achieving accurate collaborative editing of the target document.

[0124] During specific implementation, the collaborative information can be parsed and the operation conversion rules can be saved through a preset parsing library, that is, a parsing library that supports operation conversion processing is preset, which supports preset basic operations. The collaborative information generated by the conversion can be parsed through the parsing library to obtain the basic operations contained in the collaborative information so as to edit the target document accordingly. At the same time, the operation conflicts between different collaborative information are resolved according to the parsing results and the operation conversion rules. Specifically, different operation conversion rules can be called according to the order of receiving the collaborative information, the operation object of the collaborative information, etc. For example, taking a JSON document with a tree structure as the target document as an example, if the currently received collaborative information is to move subtree A, and the historical collaborative information is to delete subtree A, then the current collaborative information is a conflicting instruction. According to the conversion rules in the parsing library, the current collaborative information is converted to null, thereby avoiding document editing errors and even programming crashes, thereby ensuring the accuracy and reliability of collaborative programming.

[0125] S303. Restore the first target collaborative information into a first target programming operation for modifying the target programming work.

[0126] In this embodiment, when executing the programming operation mapped by the first target collaborative information, the first target collaborative information needs to be restored to obtain the corresponding first target programming operation for changing the building structure of the target programming work. It can be understood that the restoration process is opposite to the generation process of the first collaborative information, thereby mapping the changes to the code data in the target document to the changes to the building structure of the target programming work in real time. Among them, since the programming operation and the collaborative information are one-to-one corresponding, the first target programming operation can be regarded as the first programming operation input on the first client. The operation conversion is obtained, that is, the first programming operation is executed on the target work on the first client, and the first target programming operation obtained after the operation conversion is collaboratively executed on the second client, rather than the initial first programming operation, to avoid collaborative programming errors caused by operation conflicts between different clients.

[0127] Furthermore, the step of restoring the first target collaborative information into a first target programming operation for modifying the target programming work includes:

[0128] Parsing the first target collaborative information according to a preset parsing library to obtain a first target document operation for modifying the code data contained in the first target collaborative information;

[0129] Based on the changes made to the code data by the first target document operation, a preset conversion method is called to restore the first target document operation to a first target programming operation, where the first target programming operation is used to map the first target collaborative information to changes to the building structure of the target programming work.

[0130] or,

[0131] Decomposing the first target coordination information to obtain a plurality of unit coordination information;

[0132] Parsing the unit collaboration information in sequence according to a preset parsing library to obtain the first target document operation on the code data contained in each unit collaboration information;

[0133] Based on the changes made to the code data by the first target document operation, a preset conversion method is called to restore the first target document operation to a first target programming operation, and the first target programming operation is used to map the first target collaborative information to changes to the building structure of the target programming work.

[0134] In this embodiment, after receiving the first target collaborative information, it is parsed by a preset parsing library, thereby restoring the first target collaborative information to a first target programming operation on the target programming work. Specifically, according to the difference in how the first client sends the first collaborative information, there are two situations. When the first client converts a single first programming operation obtained into first collaborative information and sends it to the server for operation conversion processing, the first target collaborative information obtained after the operation conversion is an independent instruction rather than a combined instruction. Therefore, the first target document operation contained in the first target collaborative information is directly parsed and obtained. Similarly, the first target document operation is a preset basic operation for changing the code data in the target document. The first target collaborative information may contain one or more basic operations. Editing the code data in the target document through basic operations with higher atomicity is more conducive to resolving editing conflicts. Based on the changes to the code data made by the first target document operation, the preset conversion method is also called to convert between collaborative information and programming operations, and the single first target collaborative information obtained is restored to a single first target programming operation, thereby mapping the changes to the target document made by one or more basic operations to changes to the building structure of the target programming work.

[0135] When the first client converts several first programming operations in the preset operation node as an operation combination to generate the first collaborative information, the first target collaborative information obtained by the operation conversion can be decomposed to obtain several unit collaborative information. Therefore, all the unit collaborative information are parsed in turn through the preset parsing library to obtain the first target document operation (also the preset basic operation) contained in each unit collaborative information. Each unit collaborative information may contain one or more basic operations. Based on the changes to the code data made by the first target document operation, the preset conversion method is also called to convert between the collaborative information and the programming operation. The conversion results are combined in the parsing order and then restored to obtain the first target programming operation. At this time, the first target programming operation is an operation combination, which contains at least two programming operations with sequence dependencies, thereby realizing the restoration of different collaborative programming operations and avoiding erroneous parsing during the collaboration of the operation combination.

[0136] During the specific restoration, one or more first target document operations are converted and restored into corresponding first target programming operations. The first target document operations may include different operation types, and the corresponding first target programming operations are realized by combining different operation types. Taking the target document as a tree-structured JSON document as an example, the first target document operation includes three types of basic operations: picking up subtree operations, inserting subtree operations, and editing subtree object operations. A simple basic operation includes a list and an operation component. The list contains the path to find specific content in the JSON tree, and the operation component contains the basic operations on the content. Therefore, when converting between collaborative information and programming operations, the corresponding programming operations are restored through a combination of one or more first target document operations of operation types, and the collaborative editing at the document data level is mapped to the collaborative editing at the programming operation level, thereby realizing accurate collaborative programming.

[0137] S304: Display the collaborative programming result after the target programming work is modified by the first target programming operation.

[0138] In this embodiment, after the first target programming operation is restored, the first target programming operation is applied to the target programming work on the second client. Since the first target programming operation is restored by the first target collaborative information obtained after the operation conversion processing, the first target programming operation has resolved the conflict between the programming operations corresponding to the historical collaborative information received by the server. Therefore, the programming result obtained by the first target programming operation on the second client to change the target programming work is consistent with the programming result obtained by the first programming operation on the first client to change the target programming work, thereby realizing accurate and efficient building block collaborative programming.

[0139] The collaborative programming method further includes:

[0140] When there is a conflict between the first target programming operation and a second programming operation obtained locally, conflict resolution is performed on the second programming operation and the first target programming operation according to a preset operation priority ranking.

[0141] In this embodiment, not only is conflict handling performed for document editing, but conflict handling at the operational level is also performed when there is a conflict between the restored first target programming operation and the second programming operation locally obtained by the second client. Since the operation conversion processing resolves the document editing conflict between collaborative information, and when there is a second programming operation on the second client that has not yet been converted to generate collaborative information, the operation conversion processing cannot resolve the conflict for this type of second programming operation. At this time, if the restored first target programming operation is directly applied to the target programming work on the second client, programming errors or even client crashes will occur.

[0142] Therefore, in order to further ensure the correctness of collaborative programming, an operational-level conflict judgment can be performed on the first target programming operation received from the server and the second programming operation locally on the second client. Specifically, the judgment can be made based on whether the operation objects of the programming operations have a mutual inclusion relationship. That is, if the operation objects of different programming operations have a mutual inclusion relationship, it means that there is a conflict; otherwise, there is no conflict. When there is a conflict, the conflict is handled according to the operation priority ranking of different operations. The specific operation priority ranking can be sorted by time. For example, the time when the server receives the first collaborative information and the input time of the local input second programming operation are obtained. The earlier the time, the higher the priority, etc. Of course, other priority sorting rules can also be used, and this embodiment does not limit this. Specifically, the operation sent to the server first has a higher priority. When the second client receives the operation sent by the server, if there is an ongoing operation locally, it is determined whether there is a conflict. When determining the conflict, taking the operation combination as an example, the first target collaborative information sent by the server is first decomposed to obtain the unit collaborative information. In the order of disconnection, deletion, movement, and connection, it is determined in turn whether the operation corresponding to the unit collaborative information conflicts with the local second programming operation. Taking the dragging of building blocks as an example, when there are deletion, movement, and connection operations on building blocks in the first target programming operation sent by the server, it is necessary to check whether the dragging operation is currently in progress on the second client, and then perform conflict processing. If the building block group dragged in the first target programming operation sent by the server and the building block group being dragged by the local second programming operation have a mutual inclusion relationship, it means that there is a conflict. When there is a conflict, since the operation sent to the server first has a higher priority, the local second programming operation is canceled at this time, the object changes caused by the local second programming operation are rolled back, and the events generated by the local operation are cleared to ensure that there will be no operation conflicts at the client operation level and improve the accuracy of collaborative programming.

[0143] The collaborative programming method further includes:

[0144] obtaining a second programming operation on the target programming work;

[0145] converting the second programming operation into second collaborative information for editing the target document;

[0146] When a sharing instruction is obtained, the second collaborative information is sent to the server, where the sharing instruction is used to instruct the server to send the second target collaborative information to the first client.

[0147] The second target collaborative information is obtained by performing an operation conversion process on the second collaborative information to resolve an editing conflict between the second collaborative information and the historical collaborative information received by the server.

[0148] In this embodiment, after the user logs in to the second client through the second account, the user can input a second programming operation on the target programming work through the graphical programming interface on the second client, and convert the second programming operation into second collaborative information for editing the target document. After that, the user can input a sharing instruction by clicking a preset button such as "Share" on the graphical programming interface. After obtaining the sharing instruction, the converted second collaborative information is sent to the server. The sharing instruction instructs the server to send the second target collaborative information to the specified first client to realize collaborative sharing of programming operations, wherein the second target collaborative information is obtained by the operation conversion processing of the second collaborative information to resolve the editing conflict between the second collaborative information and the historical collaborative information received by the server, so that the corresponding collaborative programming result after the first target collaborative information edits the target document is displayed on the first client. Similarly, the generation method of the second collaborative information is the same as the generation method of the first collaborative information, and the sending method of the second target collaborative information is the same as the sending method of the first target collaborative information, which will not be repeated here.

[0149] That is, each second client can not only receive the first target collaborative information sent by the server, but also send the second collaborative information generated based on the second programming operation to the server. After the server performs operation conversion processing, the second target collaborative information is sent to the first client, so that the corresponding collaborative programming result after the second target collaborative information edits the target document is displayed on the local interface of the first client. In this way, collaborative programming of the same target programming work can be realized between multiple clients, which enhances the information interoperability and programming efficiency between users of different clients.

[0150] The above mainly introduces the collaborative programming method from the perspective of the client participating in collaborative programming. The following will introduce the collaborative programming method from the perspective of the server.

[0151] See also Figure 5 , Figure 5 This is a flowchart of an embodiment of the collaborative programming method provided by the present invention, which is applied to.

[0152] like Figure 5 As shown, the method specifically includes the following steps:

[0153] S501: Receive first collaboration information and a sharing instruction sent by a first client, where the first collaboration information is used to edit a target document mapped to a target programming work, and the sharing instruction carries an identifier of a second client.

[0154] In this embodiment, the server receives first collaborative information and sharing instructions sent by the first client, wherein the first collaborative information is converted based on the first programming operation on the target programming work on the first client, and is used to edit the target document that is mapped in real time with the target programming work. The sharing instruction carries the identifier of the second client, and the sharing instruction is used to instruct the server to perform information collaborative processing on the second client identified by the identifier. The conversion and generation method of the first collaborative information has been described in detail in the method executed by the first client and will not be repeated here.

[0155] Furthermore, if Figure 6 As shown, before step S501, the method further includes the steps of:

[0156] S504: Convert the target programming work into a target document in a preset format according to the construction structure of the target programming work and distribute the document to the first client and the second client.

[0157] In this embodiment, the target programming work is stored in the shared space of the server. The server converts the target programming work into a target document in a preset format based on the structure of the target programming work, and distributes the target document to the first client and the second client. That is, in this embodiment, the conversion operation of converting the target programming work into the target document is performed on the server. Each client does not need to perform the conversion operation and can directly obtain the target document from the server, thereby improving processing efficiency. Preferably, the target document adopts the JSON format, and the target document in the JSON format uses a preset structure to save the code data of the target programming work to adapt to the parsing and conflict handling rules in the preset parsing library to achieve the resolution of document editing conflicts. The conversion and generation method of the target document has been described in detail in the method executed by the first client and will not be repeated here.

[0158] S502: Performing an operation conversion process on the first collaborative information according to the historical collaborative information in the received record to obtain first target collaborative information, so as to resolve the editing conflict between the first collaborative information and the historical collaborative information.

[0159] When the server receives the first collaborative information, it performs operation conversion processing on the first collaborative information according to the historical collaborative information in the reception record. The operation conversion processing method adopted has been described in detail in the method executed by the second client and will not be repeated here.

[0160] Furthermore, the step of performing an operation conversion process on the first collaborative information according to the historical collaborative information in the received record to obtain the first target collaborative information includes:

[0161] Obtaining instruction reception time of the historical collaboration information and the first collaboration information, and sorting the instruction reception time, wherein the historical collaboration information comes from the first client or the second client;

[0162] When there is a conflict between the first collaborative information and the historical collaborative information, the first collaborative information is subjected to operational conversion processing according to the order of instruction reception time and preset conversion rules to resolve the editing conflict between the first collaborative information and the historical collaborative information.

[0163] In this embodiment, the historical collaborative information and the first collaborative information are sorted according to the instruction reception time. Since the first client and the second client can both send collaborative information to the outside, the historical collaborative information may come from the first client or the second client, and need to be considered together during the operation conversion processing. If there is a conflict between the first collaborative information and the historical collaborative information, it can be determined based on whether the execution objects of each instruction have a mutual inclusion relationship, and the first collaborative information is subjected to operation conversion processing according to the preset conversion rules based on the instruction reception time, that is, the corresponding operation conversion rules are called in the preset parsing library to resolve various instruction conflicts. The operation conversion processing method adopted has been introduced in detail in the method executed by the second client, and will not be repeated here.

[0164] S503: Send the first target collaboration information to the second client identified by the identifier according to the instruction of the sharing instruction.

[0165] In this embodiment, under the instruction of the sharing instruction, the first target collaborative information obtained after the operation conversion processing is sent to the corresponding second client through the identifier carried in the sharing instruction. Specifically, the identifier can be the address information of the second client, such as the IP address, or it can be the ID information of the user currently using the second client, etc. The server sends the first target collaborative information to the second client specified by the first client through accurate identification information to ensure the accurate distribution and sharing of collaborative information in collaborative programming.

[0166] Furthermore, after step S502, the method further includes:

[0167] Sending instruction confirmation information to the first client.

[0168] In this embodiment, after the server performs operation conversion processing on the first collaborative information received, it promptly sends instruction confirmation information to the first client so that the first client can know the processing status of the first collaborative information currently sent, and update its own collaborative status based on the processing status of the first collaborative information, thereby achieving accurate status updates and ensuring orderliness and status visibility during the collaborative programming process.

[0169] Specifically, combined Figure 7 and Figure 8 The communication process between different clients and servers in this embodiment is described as follows:

[0170] like Figure 7 As shown, each client has an OT module to realize the conversion between programming operations and collaborative information, wherein the OT module is composed of an OT adapter and an OT client, wherein the OT adapter (OT Adapter) includes two conversion units, the first conversion unit is used to convert programming operations into OT instructions, and the second conversion unit is used to restore OT instructions to programming operations; the OT client (OT Client) is used to maintain the collaborative status and logical processing of the client, and to interact with the server; the server (OT Server) is used to perform operation conversion processing and instruction distribution of OT instructions between multiple clients. By constructing this operation conversion model, JSON documents can be edited simultaneously and conflicts can be resolved.

[0171] In specific applications, such as Figure 8 As shown in the figure, when user A performs programming operation A on the target programming work on client A, and hopes to synchronize programming operation A to client B used by user B, client A sends programming operation A to the OT adapter. The OT adapter converts programming operation A into OT instructions and then sends the OT instructions to the OT client. The OT client then performs different processing based on the current status of client A:

[0172] If client A is currently in the Synchronized state, it will immediately send the OT instruction to the server, and the collaborative state will change to the Awaiting Confirm state;

[0173] If client A is currently in the Awaiting Confirm state, the command will not be sent immediately, and the collaboration state will be changed to the Awaiting With Buffer state;

[0174] If client A is currently in the Awaiting With Buffer state, the instruction is not sent immediately and the state remains in the Awaiting With Buffer state.

[0175] The server performs operation conversion processing on the OT instruction currently received from client A based on the OT instructions received historically, and sends instruction confirmation information to the source client of the instruction, namely client A, and sends the OT instruction after operation conversion processing to the other client, namely client B.

[0176] Furthermore, after receiving the instruction confirmation information, the OT client in client A performs different processing according to the current status of client A:

[0177] If client A is in the Synchronized state, there should be no confirmation information waiting at this time, so an error message is thrown;

[0178] If client A is in the Awaiting Confirm state, update the collaboration state to Synchronized;

[0179] If client A is in the Awaiting With Buffer state, indicating that the previous instruction has been confirmed, the instruction in the buffer is sent, and if there are no other instructions in the buffer, the collaborative state is updated to Awaiting Confirm, otherwise it remains in the Awaiting With Buffer state.

[0180] Furthermore, the OT client in client B receives the OT instruction sent by the service after the operation conversion processing. The server performs different processing according to the current status of the client to be coordinated:

[0181] If client B is in the Synchronized state, it directly applies the OT instruction to the local shared building block code JSON document and sends the OT instruction to the OT adapter in the client to be coordinated, and the state remains Synchronized;

[0182] If client B is in the Awaiting Confirm state, the local unconfirmed instructions may conflict with the received instructions. Therefore, a secondary operation conversion is required through the OT client. If the OT client conversion is successful, the converted OT instructions are applied to the local shared building block code JSON document and sent to the OT adapter. The state remains Awaiting Confirm. Otherwise, an error is thrown.

[0183] If client B is in the Awaiting With Buffer state, the OT client performs a secondary operation conversion on the received instructions, the local instructions to be confirmed, and the local instructions to be sent. If the OT client converts successfully, the converted OT instructions are applied to the local shared building block code JSON document and sent to the OT adapter. The state remains Awaiting With Buffer. Otherwise, an error is thrown.

[0184] The OT adapter in client B receives the OT instruction with resolved document editing conflicts, restores it to programming operation A after operation conversion, and resolves the conflict between the restored programming operation A and the local programming operation before applying the restored programming operation A to the target programming work on client B. This allows the building block programming operations input by user A on client A to be accurately synchronized in real time to client B used by user B to log in, thus achieving accurate and efficient collaborative programming.

[0185] It can be seen from the above method embodiments that the collaborative programming method provided by the present invention uses documents to map the code data of programming works in real time, converts programming operations into collaborative information for editing documents during collaborative programming and distributes it to each client, thereby realizing real-time sharing of programming operations, and resolving editing conflicts of target documents by different clients through operation conversion processing, thereby obtaining accurate and real-time collaborative programming results.

[0186] It should be noted that there is not necessarily a certain order between the above steps. A person skilled in the art can understand, based on the description of the embodiments of the present invention, that in different embodiments, the above steps may have different execution orders, that is, they may be executed in parallel, or may be executed interchangeably, etc.

[0187] Another embodiment of the present invention provides a collaborative programming device, which can be applied to a first terminal device installed with a first client, such as Figure 9 As shown, the apparatus 900 includes:

[0188] An operation acquisition module 901 is configured to acquire a first programming operation for a target programming work;

[0189] An information generating module 902 is configured to convert the first programming operation into first collaborative information for editing a target document, wherein the target document is used to map code data of the target programming work;

[0190] Information sending module 903, used for

[0191] When a sharing instruction is obtained, the first collaborative information is sent to the server, where the sharing instruction is used to instruct the server to send the first target collaborative information to the second client communicating with the first client.

[0192] The first target collaborative information is obtained by performing an operation conversion process on the first collaborative information to resolve an editing conflict between the first collaborative information and historical collaborative information received by the server.

[0193] The operation acquisition module 901, the information generation module 902 and the information sending module 903 are connected in sequence. The module referred to in the present invention refers to a series of computer program instruction segments that can complete specific functions, which is more suitable for describing the execution process of the collaborative programming than the program. For the specific implementation of each module, please refer to the corresponding method embodiment above, which will not be repeated here.

[0194] Furthermore, the collaborative programming device further includes:

[0195] The document conversion module is used to convert the target programming work into a target document in a preset format according to the construction structure of the target programming work and save it locally.

[0196] Furthermore, the information generation module 902 includes:

[0197] a first conversion unit configured to, based on the modification of the target programming work by the first programming operation, call a preset conversion method to convert the first programming operation into a corresponding first document operation, wherein the first document operation is used to correspondingly modify code data in the target document;

[0198] a first generating unit, configured to generate the first coordination information according to the first document operation, wherein the first coordination information is used to map the first programming operation to a change to code data in the target document;

[0199] a second conversion unit, configured to modify the target programming work based on the operation combination within a preset operation node, and call a preset conversion method to sequentially convert the first programming operations included in the operation combination into corresponding first document operations, wherein the first document operations are used to modify the code data in the target document accordingly;

[0200] The second generation unit is used to generate unit collaboration information according to the first document operation, and to obtain the first collaboration information after combining the unit collaboration information in a conversion order. The first collaboration information is used to map the operation combination into a change to the code data in the target document.

[0201] Furthermore, the information sending module 903 includes:

[0202] a status confirmation unit, configured to confirm the collaborative status of the first client upon receiving a sharing instruction, wherein the collaborative status includes a synchronized state, a waiting state for confirmation, and a buffered waiting state, and the sharing instruction carries an identifier of the second client;

[0203] An instruction sending unit is used to send the first collaboration information to the server if the collaboration state of the first client is a synchronized state, and to instruct the server to send the first target collaboration information to the second client determined by the identifier through the sharing instruction.

[0204] Furthermore, the collaborative programming device further includes:

[0205] A status update module is used to update the collaboration status of the first client after sending the first collaboration information to the server, and to update the collaboration status of the first client when receiving instruction confirmation information returned by the server.

[0206] Furthermore, the collaborative programming device further includes:

[0207] An instruction acquisition module, configured to acquire a collaborative creation instruction, wherein the collaborative creation instruction is used to instruct the first client to establish collaborative communication with the second client;

[0208] A creation module is used to create a target programming work according to the collaborative creation instruction and send the target programming work to the server.

[0209] Furthermore, the collaborative programming device further includes:

[0210] an information receiving module, configured to receive second target collaborative information sent by the server, where the second target collaborative information is obtained by performing an operation conversion process on the second collaborative information sent by the second client, so as to resolve an editing conflict between the second collaborative information and the historical collaborative information received by the server;

[0211] A document editing module, configured to edit the target document according to the second target collaborative information;

[0212] An execution display module is used to display the collaborative programming result of the target programming work obtained by mapping the target document after editing the target document using the second target collaborative information.

[0213] Furthermore, the collaborative programming device further includes:

[0214] an operation restoration module, configured to restore the second target collaborative information into a second target programming operation for modifying the target programming work;

[0215] The conflict handling module is configured to handle the conflict between the second target programming operation and the first programming operation obtained locally according to a preset operation priority order when the second target programming operation conflicts with the first programming operation obtained locally.

[0216] Another embodiment of the present invention provides a collaborative programming device, which can be applied to a second terminal device installed with a second client, such as Figure 10 As shown, the apparatus 1000 includes:

[0217] The information receiving module 1001 is configured to receive first target collaborative information sent by the server, where the first target collaborative information is obtained by performing an operation conversion process on the first collaborative information sent by the first client, so as to resolve an editing conflict between the first collaborative information and historical collaborative information received by the server;

[0218] A document editing module 1002, configured to edit the target document according to the first target collaborative information, wherein the target document is used to map code data of the target programming work;

[0219] An operation restoration module 1003, configured to restore the first target collaborative information into a first target programming operation for modifying the target programming work;

[0220] The execution display module 1004 is configured to display the collaborative programming result after the target programming work is modified by the first target programming operation.

[0221] The information receiving module 1001, the document editing module 1002, the operation restoration module 1003 and the execution display module 1004 are connected in sequence. The module referred to in the present invention refers to a series of computer program instruction segments that can complete specific functions, which is more suitable for describing the execution process of the collaborative programming than a program. For the specific implementation of each module, please refer to the corresponding method embodiment above, which will not be repeated here.

[0222] Furthermore, the collaborative programming device further includes:

[0223] The document conversion module is used to convert the target programming work into a target document in a preset format according to the construction structure of the target programming work and save it locally.

[0224] Furthermore, the document editing module 1002 includes:

[0225] A status confirmation unit, configured to confirm a collaborative status of the second client, wherein the collaborative status includes a synchronized state, a waiting state for confirmation, and a buffered waiting state;

[0226] an editing unit, configured to edit the target document according to the first target collaboration information if the collaboration state of the second client is a synchronized state;

[0227] Furthermore, if the collaboration state of the second client is a waiting state for confirmation or a buffered waiting state, the first target collaboration information is subjected to a secondary operation conversion process, and the target document is edited according to the first target collaboration information after the secondary operation conversion process.

[0228] Furthermore, the operation restoration module 1003 includes:

[0229] a first parsing unit, configured to parse the first target collaborative information according to a preset parsing library, and obtain a first target document operation for modifying the code data contained in the first target collaborative information;

[0230] A first restoration unit is configured to call a preset conversion method to restore the first target document operation to a first target programming operation based on the change to the code data by the first target document operation, wherein the first target programming operation is used to map the first target collaborative information to a change to the building structure of the target programming work.

[0231] a decomposition unit, configured to decompose the first target coordination information into a plurality of unit coordination information;

[0232] a second parsing unit, configured to parse the unit collaboration information in sequence according to a preset parsing library, and obtain a first target document operation on the code data contained in each unit collaboration information;

[0233] A second restoration unit is used to call a preset conversion method to restore the first target document operation to a first target programming operation based on the change of the code data by the first target document operation, and the first target programming operation is used to map the first target collaborative information to a change to the building structure of the target programming work.

[0234] Furthermore, the collaborative programming device further includes:

[0235] The conflict handling module is configured to handle the conflict between the first target programming operation and the locally acquired second programming operation according to a preset operation priority order when the first target programming operation conflicts with the second programming operation.

[0236] Furthermore, the collaborative programming device further includes:

[0237] a creation module, configured to create a target programming work and send the target programming work to the server;

[0238] Works receiving module, used to receive the target programming works sent by the server

[0239] Furthermore, the collaborative programming device further includes:

[0240] an operation acquisition module, configured to acquire a second programming operation on the target programming work;

[0241] an information generating module, configured to convert the second programming operation into second collaborative information for editing the target document;

[0242] An information sending module is used to send the second collaborative information to the server when a sharing instruction is obtained, and the sharing instruction is used to instruct the server to send the second target collaborative information to the first client.

[0243] The second target collaborative information is obtained by performing an operation conversion process on the second collaborative information to resolve an editing conflict between the second collaborative information and the historical collaborative information received by the server.

[0244] Another embodiment of the present invention provides a server, such as Figure 11 As shown, the server 1100 includes:

[0245] The receiving module 1101 is configured to receive first collaboration information and a sharing instruction sent by a first client, wherein the first collaboration information is used to edit a target document mapped to a target programming work, and the sharing instruction carries an identifier of a second client;

[0246] An operation conversion module 1102 is configured to perform an operation conversion process on the first collaborative information according to the historical collaborative information in the received record to obtain first target collaborative information, so as to resolve the editing conflict between the first collaborative information and the historical collaborative information;

[0247] The sending module 1103 is configured to send the first target collaboration information to the second client identified by the identifier according to the instruction of the sharing instruction.

[0248] The receiving module 1101, the operation conversion module 1102 and the sending module 1103 are connected in sequence. The module referred to in the present invention refers to a series of computer program instruction segments that can complete specific functions, which is more suitable for describing the execution process of the collaborative programming than the program. For the specific implementation of each module, please refer to the corresponding method embodiment above, which will not be repeated here.

[0249] Furthermore, the server further includes:

[0250] The document conversion module is used to convert the target programming work into a target document in a preset format according to the construction structure of the target programming work and distribute the target document to the first client and the second client.

[0251] Furthermore, the operation conversion module 1102 includes:

[0252] a sorting unit, configured to obtain instruction reception times of the historical collaboration information and the first collaboration information, and sort the instruction reception times, wherein the historical collaboration information originates from the first client or the second client;

[0253] An operation conversion unit is used to perform operation conversion processing on the first collaborative information according to the preset conversion rules based on the order of instruction reception time when there is a conflict between the first collaborative information and the historical collaborative information, so as to resolve the editing conflict between the first collaborative information and the historical collaborative information.

[0254] Furthermore, the server further includes:

[0255] A confirmation module is used to send instruction confirmation information to the first client.

[0256] Another embodiment of the present invention provides a collaborative programming system, such as Figure 12 As shown, the system 1200 includes:

[0257] One or more processors 1201 and memory 1202, Figure 12 In the description, a processor 1201 is used as an example. The processor 1201 and the memory 1202 may be connected via a bus or other means. Figure 12 The bus connection is taken as an example.

[0258] Processor 1201 is used to complete various control logics of system 1200. It can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISC Machine) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. In addition, processor 1201 can also be any traditional processor, microprocessor, or state machine. Processor 1201 can also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors combined with a DSP, and / or any other such configuration.

[0259] Memory 1202, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs, and modules, such as program instructions corresponding to the collaborative programming method in the embodiments of the present invention. Processor 1201 executes the non-volatile software programs, instructions, and modules stored in memory 1202 to execute various functional applications and data processing of system 1200, thereby implementing the collaborative programming method in the above-mentioned method embodiments.

[0260] Memory 1202 may include a program storage area and a data storage area. The program storage area may store an operating system and application programs required for at least one function; the data storage area may store data generated based on the use of system 1200. Furthermore, memory 1202 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state memory device. In some embodiments, memory 1202 may optionally include memory remotely located relative to processor 1201. Such remote memory may be connected to system 1200 via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0261] One or more units are stored in the memory 1202, and when executed by one or more processors 1201, the collaborative programming method in any of the above method embodiments is executed, for example, the above described collaborative programming method is executed. Figure 1 Steps S101 to S103 of the method, or performing the above-described Figure 3 Steps S301 to S304 of the method, or performing the above-described Figure 5 Steps S501 to S503 of the method.

[0262] An embodiment of the present invention provides a non-volatile computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, which are executed by one or more processors, for example, to execute the above-described Figure 1 Steps S101 to S103 of the method, or performing the above-described Figure 3 Steps S301 to S304 of the method, or performing the above-described Figure 5 Steps S501 to S503 of the method.

[0263] As examples, non-volatile storage media can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) as external cache memory. By way of illustration and not limitation, RAM can be obtained in many forms such as synchronous RAM (SRAM), dynamic RAM, (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The disclosed memory components or memories of the operating environment described herein are intended to include one or more of these and / or any other suitable types of memory.

[0264] In summary, the present invention discloses a collaborative programming method, device, system, server and medium, wherein the method obtains a first programming operation on a target programming work; converts the first programming operation into first collaborative information for editing a target document, and the target document is used to map the code data of the target programming work; when a sharing instruction is obtained, the first collaborative information is sent to the server to instruct the server to send the first target collaborative information to the second client, and the first target collaborative information is obtained by performing an operation conversion process on the first collaborative information to resolve the editing conflict between the first collaborative information and the historical collaborative information. The code data of the target programming work is mapped in real time through the target document, and during collaborative programming, the programming operation on the target programming work is converted into collaborative information for editing the target document and distributed to each client to realize real-time sharing of programming operations, thereby improving the real-time nature of collaborative programming, and also resolving editing conflicts of the target document by different clients through operation conversion processing, thereby improving the accuracy of collaborative programming, and thus obtaining real-time and accurate collaborative programming results.

[0265] Of course, those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware (such as a processor, controller, etc.) through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes in the above-described method embodiments. The storage medium can be a memory, a magnetic disk, a floppy disk, a flash memory, an optical storage device, etc.

[0266] It should be understood that the application of the present invention is not limited to the above examples. For those skilled in the art, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.

Claims

1. A collaborative programming method, characterized in that: The method is applied to a first client, and includes: Obtaining a first programming operation on a target programming work; converting the first programming operation into first collaborative information for editing a target document, the target document being used to map code data of the target programming work; When a sharing instruction is obtained, the first collaborative information is sent to the server, where the sharing instruction is used to instruct the server to send the first target collaborative information to the second client communicating with the first client; The first target collaborative information is obtained by performing an operation conversion process on the first collaborative information to resolve an editing conflict between the first collaborative information and historical collaborative information received by the server; The converting the first programming operation into first collaborative information for editing the target document includes: Based on the modification of the target programming work by the first programming operation, calling a preset conversion method to convert the first programming operation into a corresponding first document operation, where the first document operation is used to modify code data in the target document accordingly; generating the first coordination information according to the first file operation, wherein the first coordination information is used to map the first programming operation to a change to code data in the target file; or, Based on the changes made to the target programming work by the operation combination within the preset operation node, calling a preset conversion method to sequentially convert the first programming operations included in the operation combination into corresponding first document operations, where the first document operations are used to correspondingly change the code data in the target document; generating unit collaboration information according to the first document operation, and combining the unit collaboration information in a conversion order to obtain the first collaboration information, wherein the first collaboration information is used to map the operation combination to a change to code data in the target document; When the sharing instruction is obtained, sending the first collaborative information to the server includes: When a sharing instruction is obtained, the collaborative state of the first client is confirmed, where the collaborative state includes a synchronized state, a waiting state for confirmation, and a buffered waiting state. The sharing instruction carries an identifier of the second client. If the collaboration state of the first client is the synchronized state, sending the first collaboration information to the server, and instructing the server to send the first target collaboration information to the second client determined by the identifier through the sharing instruction; The method further comprises: updating the collaborative state of the first client after sending the first collaborative information to the server, and updating the collaborative state of the first client upon receiving instruction confirmation information returned by the server; The method further comprises: receiving second target collaborative information sent by the server, where the second target collaborative information is obtained by operation conversion processing of the second collaborative information sent by the second client, so as to resolve an editing conflict between the second collaborative information and the historical collaborative information received by the server; Editing the target document according to the second target collaborative information; Displaying the collaborative programming result of the target programming work obtained by mapping the target document after editing the target document using the second target collaborative information; The method further comprises: restoring the second target collaborative information into a second target programming operation for modifying the target programming work; When there is a conflict between the second target programming operation and the locally acquired first programming operation, conflict resolution is performed on the second target programming operation and the first programming operation according to a preset operation priority ranking.

2. The collaborative programming method according to claim 1, characterized in that: When the target document is a JSON document with a tree structure, the first document operation includes a subtree picking operation, a subtree inserting operation, and a subtree object editing operation.

3. The collaborative programming method according to claim 1, wherein: The method further comprises: Obtaining a collaborative creation instruction, where the collaborative creation instruction is used to instruct the first client to establish collaborative communication with the second client; A target programming work is created according to the collaborative creation instruction, and the target programming work is sent to the server.

4. The collaborative programming method according to claim 1, wherein: Before obtaining the first programming operation on the target programming work, the method further includes: The target programming work is converted into a target document in a preset format according to the construction structure of the target programming work and is saved locally.

5. A collaborative programming method, characterized in that: The method is applied to a second client, the second client communicating collaboratively with the first client, and the method includes: receiving first target collaborative information sent by the server, where the first target collaborative information is obtained by operation conversion processing of the first collaborative information sent by the first client, so as to resolve an editing conflict between the first collaborative information and historical collaborative information received by the server; Editing a target document according to the first target collaborative information, wherein the target document is used to map code data of a target programming work; restoring the first target collaborative information into a first target programming operation for modifying the target programming work; displaying a collaborative programming result after the target programming work is modified by the first target programming operation; The restoring the first target collaborative information into a first target programming operation for modifying the target programming work includes: Parsing the first target collaborative information according to a preset parsing library to obtain a first target document operation for modifying the code data contained in the first target collaborative information; Based on the changes made to the code data by the first target document operation, a preset conversion method is called to restore the first target document operation to a first target programming operation, where the first target programming operation is used to map the first target collaborative information to changes to the building structure of the target programming work. or, Decomposing the first target coordination information to obtain a plurality of unit coordination information; Parsing the unit collaboration information in sequence according to a preset parsing library to obtain the first target document operation on the code data contained in each unit collaboration information; Based on the changes to the code data caused by the first target document operation, calling a preset conversion method to restore the first target document operation to a first target programming operation, where the first target programming operation is used to map the first target collaboration information to changes to the building structure of the target programming work; The method further comprises: obtaining a second programming operation on the target programming work; converting the second programming operation into second collaborative information for editing the target document; When a sharing instruction is obtained, the second collaborative information is sent to the server, where the sharing instruction is used to instruct the server to send the second target collaborative information to the first client. The second target collaborative information is obtained by performing an operation conversion process on the second collaborative information to resolve an editing conflict between the second collaborative information and the historical collaborative information received by the server.

6. The collaborative programming method according to claim 5, characterized in that: The editing of the target document according to the first target collaborative information includes: Confirming the collaborative state of the second client, the collaborative state including a synchronized state, a waiting for confirmation state, and a buffered waiting state; If the collaboration state of the second client is synchronized, editing the target document according to the first target collaboration information; If the collaboration state of the second client is a waiting state for confirmation or a buffered waiting state, a secondary operation conversion process is performed on the first target collaboration information, and the target document is edited according to the first target collaboration information after the secondary operation conversion process.

7. The collaborative programming method according to claim 5, characterized in that: When the target document is a JSON document with a tree structure, the first target document operation includes a subtree picking operation, a subtree inserting operation, and a subtree object editing operation.

8. The collaborative programming method according to claim 5, characterized in that: The method further comprises: When there is a conflict between the first target programming operation and a second programming operation obtained locally, conflict resolution is performed on the second programming operation and the first target programming operation according to a preset operation priority ranking.

9. The collaborative programming method according to claim 5, characterized in that: The method further comprises: creating a target programming work and sending the target programming work to the server, or, Receive the target programming work sent by the server.

10. The collaborative programming method according to claim 5, characterized in that: Before receiving the first target collaboration information sent by the server, the method further includes: The target programming work is converted into a target document in a preset format according to the construction structure of the target programming work and is saved locally.

11. A collaborative programming method, the method being applied to a server, characterized in that: include: receiving first collaboration information and a sharing instruction sent by a first client, wherein the first collaboration information is used to edit a target document mapped to the target programming work, and the sharing instruction carries an identifier of the second client; performing an operation conversion process on the first collaborative information according to the historical collaborative information in the received record to obtain first target collaborative information, so as to resolve the editing conflict between the first collaborative information and the historical collaborative information; According to the instruction of the sharing command, the first target collaboration information is sent to the second client determined by the identifier.

12. The collaborative programming method according to claim 11, characterized in that: The step of performing an operation conversion process on the first collaborative information according to the historical collaborative information in the received record to obtain the first target collaborative information includes: Obtaining instruction reception time of the historical collaboration information and the first collaboration information, and sorting the instruction reception time, wherein the historical collaboration information comes from the first client or the second client; When there is a conflict between the first collaborative information and the historical collaborative information, the first collaborative information is subjected to operational conversion processing according to the order of instruction reception time and preset conversion rules to resolve the editing conflict between the first collaborative information and the historical collaborative information.

13. The collaborative programming method according to claim 11, characterized in that: After performing an operation conversion process on the first collaborative information according to the historical collaborative information in the received record to obtain the first target collaborative information, the method further includes: Sending instruction confirmation information to the first client.

14. The collaborative programming method according to claim 11, characterized in that: Before receiving the first collaboration information and the sharing instruction sent by the first client, the method further includes: The target programming work is converted into a target document in a preset format according to the construction structure of the target programming work and distributed to the first client and the second client.

15. A collaborative programming device, characterized in that: include: an operation acquisition module, configured to acquire a first programming operation on a target programming work; an information generating module, configured to convert the first programming operation into first collaborative information for editing a target document, wherein the target document is used to map code data of the target programming work; an information sending module, configured to send the first collaborative information to the server upon receiving a sharing instruction, wherein the sharing instruction is configured to instruct the server to send first target collaborative information to a second client that is in collaborative communication with the first client, wherein the first target collaborative information is obtained by performing an operation conversion process on the first collaborative information, so as to resolve an editing conflict between the first collaborative information and historical collaborative information received by the server; The converting the first programming operation into first collaborative information for editing the target document includes: Based on the modification of the target programming work by the first programming operation, calling a preset conversion method to convert the first programming operation into a corresponding first document operation, where the first document operation is used to modify code data in the target document accordingly; generating the first coordination information according to the first file operation, wherein the first coordination information is used to map the first programming operation to a change to code data in the target file; or, Based on the changes made to the target programming work by the operation combination within the preset operation node, calling a preset conversion method to sequentially convert the first programming operations included in the operation combination into corresponding first document operations, where the first document operations are used to correspondingly change the code data in the target document; generating unit collaboration information according to the first document operation, and combining the unit collaboration information in a conversion order to obtain the first collaboration information, wherein the first collaboration information is used to map the operation combination to a change to code data in the target document; When the sharing instruction is obtained, sending the first collaborative information to the server includes: When a sharing instruction is obtained, the collaborative state of the first client is confirmed, where the collaborative state includes a synchronized state, a waiting state for confirmation, and a buffered waiting state. The sharing instruction carries an identifier of the second client. If the collaboration state of the first client is the synchronized state, sending the first collaboration information to the server, and instructing the server to send the first target collaboration information to the second client determined by the identifier through the sharing instruction; The method further comprises: updating the collaborative state of the first client after sending the first collaborative information to the server, and updating the collaborative state of the first client upon receiving instruction confirmation information returned by the server; The method further comprises: receiving second target collaborative information sent by the server, where the second target collaborative information is obtained by operation conversion processing of the second collaborative information sent by the second client, so as to resolve an editing conflict between the second collaborative information and the historical collaborative information received by the server; Editing the target document according to the second target collaborative information; Displaying the collaborative programming result of the target programming work obtained by mapping the target document after editing the target document using the second target collaborative information; The method further comprises: restoring the second target collaborative information into a second target programming operation for modifying the target programming work; When there is a conflict between the second target programming operation and the locally acquired first programming operation, conflict resolution is performed on the second target programming operation and the first programming operation according to a preset operation priority ranking.

16. A collaborative programming device, characterized in that: include: An information receiving module is configured to receive first target collaborative information sent by a server, where the first target collaborative information is obtained by performing an operation conversion process on the first collaborative information sent by the first client, so as to resolve an editing conflict between the first collaborative information and historical collaborative information received by the server; a document editing module, configured to edit a target document according to the first target collaborative information, wherein the target document is used to map code data of a target programming work; an operation restoration module, configured to restore the first target collaborative information into a first target programming operation for modifying the target programming work; An execution display module is used to display the collaborative programming result after the target programming work is modified by the first target programming operation; The restoring the first target collaborative information into a first target programming operation for modifying the target programming work includes: Parsing the first target collaborative information according to a preset parsing library to obtain a first target document operation for modifying the code data contained in the first target collaborative information; Based on the changes made to the code data by the first target document operation, a preset conversion method is called to restore the first target document operation to a first target programming operation, where the first target programming operation is used to map the first target collaborative information to changes to the building structure of the target programming work. or, Decomposing the first target coordination information to obtain a plurality of unit coordination information; Parsing the unit collaboration information in sequence according to a preset parsing library to obtain the first target document operation on the code data contained in each unit collaboration information; Based on the changes to the code data caused by the first target document operation, calling a preset conversion method to restore the first target document operation to a first target programming operation, where the first target programming operation is used to map the first target collaboration information to changes to the building structure of the target programming work; The method further comprises: obtaining a second programming operation on the target programming work; converting the second programming operation into second collaborative information for editing the target document; When a sharing instruction is obtained, the second collaborative information is sent to the server, where the sharing instruction is used to instruct the server to send the second target collaborative information to the first client. The second target collaborative information is obtained by performing an operation conversion process on the second collaborative information to resolve an editing conflict between the second collaborative information and the historical collaborative information received by the server.

17. A server, characterized in that: include: a receiving module, configured to receive first collaboration information and a sharing instruction sent by a first client, wherein the first collaboration information is used to edit a target document mapped to the target programming work, and the sharing instruction carries an identifier of a second client; an operation conversion module, configured to perform an operation conversion process on the first collaborative information according to the historical collaborative information in the received record to obtain first target collaborative information, so as to resolve an editing conflict between the first collaborative information and the historical collaborative information; A sending module is used to send the first target collaboration information to the second client determined by the identifier according to the instruction of the sharing instruction.

18. A collaborative programming system, characterized in that The system includes at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the collaborative programming method as described in any one of claims 1 to 9, or execute the collaborative programming method as described in any one of claims 5 to 10, or execute the collaborative programming method as described in any one of claims 11 to 14.

19. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, which, when executed by one or more processors, enable the one or more processors to execute the collaborative programming method as described in any one of claims 1 to 9, or the collaborative programming method as described in any one of claims 5 to 10, or the collaborative programming method as described in any one of claims 11 to 14.

Citation Information

Patent Citations

  • A program sharing method and system based on artificial intelligence

    CN108984693A

  • Graphical collaborative programming method, device, system, server and storage medium

    CN110941425A