Code reuse method and device, development plug-in, equipment, medium and program product
By responding to the design draft query request on the code development tool side and obtaining the design logo and basic parameters of the design draft, the problem of low code development efficiency in large-scale code development projects is solved, and efficient reuse of the design draft and rapid acquisition of code snippets are achieved.
Patent Information
- Application Number
- CN202411890540.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-03-21
AI Technical Summary
Existing code editing solutions are inefficient in development in large code development projects and cannot effectively reuse component code in design drafts.
By responding to the design draft query request on the code development tool side, obtain the design logo and basic parameters of the design draft, obtain the design draft and send it to the code development tool side, receive the component's code transfer request and obtain the matching code snippet.
It shortens the time to find design drafts, improves code development efficiency, simplifies code reuse operations, and improves code reuse rate.
Smart Images

Figure CN119668599A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of computers and financial technology, and more specifically to a code reuse method, apparatus, development plug-in, device, medium and program product. Background Art
[0002] In code editing scenarios, code editing is usually performed based on a code editor on a single machine. However, this code editing solution has low code development efficiency and is only suitable for simple code development projects, not large code development projects. Therefore, how to improve code development efficiency is a technical problem that needs to be solved urgently. Summary of the invention
[0003] In view of the above problems, the present disclosure provides a code reuse method, apparatus, development plug-in, device, medium and program product.
[0004] According to a first aspect of the present disclosure, a code reuse method is provided, comprising: in response to a design draft query request sent by a code development tool end, obtaining a design identifier of the design draft and basic parameters of a design tool used to design the design draft, wherein the design draft is used to guide code development so as to complete the construction of a code entity; based on the design identifier and the basic parameters, obtaining the design draft, wherein the design draft is composed of multiple components; sending the design draft to the code development tool end so as to send a component conversion request after the code development tool end receives the design draft; in response to the component conversion request, obtaining a code snippet matching the component conversion request; and sending the code snippet to the code development tool end.
[0005] According to an embodiment of the present disclosure, the code reuse method further includes: when it is determined that a custom configuration file exists on the code development tool side, storing the storage path of the custom configuration file, wherein the custom configuration file is used to write association information of an associated design draft associated with the code.
[0006] According to an embodiment of the present disclosure, in response to a design draft query request sent by a code development tool end, a design identifier of the design draft and basic parameters of a design tool used to design the design draft are obtained, including: in response to the design draft query request sent by the code development tool end, a custom configuration file is read based on the storage path of the custom configuration file; the design identifier and the tool identifier of the design tool are parsed from the custom configuration file; and an interface matching the tool identifier is called to obtain basic parameters.
[0007] According to an embodiment of the present disclosure, the basic parameters include storage setting parameters of the design tool; obtaining the design draft based on the design identifier and the basic parameters includes: determining the root directory file storing the design draft based on the storage setting parameters; and obtaining the design draft from the root directory file based on the design identifier.
[0008] According to an embodiment of the present disclosure, a component conversion request includes: a component identifier of a component to be converted; in response to the component conversion request, obtaining a code fragment that matches the component conversion request, including: in response to the component conversion request, calling a design conversion interface that matches the component identifier to obtain a code fragment that matches the component conversion request.
[0009] According to a second aspect of the present disclosure, a code reuse method is provided, including: sending a design draft query request to a server so that the server obtains a design draft, wherein the design draft is used to guide code development so as to complete the construction of a code entity; receiving a design draft sent by the server, wherein the design draft is composed of multiple components; based on the design draft, sending a component conversion request to the server; and receiving a code snippet sent by the server that matches the component conversion request.
[0010] The third aspect of the present disclosure provides a code reuse device, including: a first acquisition module, used to respond to a design draft query request sent by a code development tool end, obtain a design identifier of a design draft and basic parameters of a design tool used to design the design draft, wherein the design draft is used to guide code development so as to complete the construction of a code entity; a second acquisition module, used to obtain the design draft based on the design identifier and the basic parameters, wherein the design draft is composed of multiple components; a first sending module, used to send the design draft to the code development tool end, so that the code development tool end sends a component conversion request after receiving the design draft; a third acquisition module, used to respond to the component conversion request, obtain a code snippet matching the component conversion request; and a second sending module, used to send the code snippet to the code development tool end.
[0011] The fourth aspect of the present disclosure provides a code reuse device, including: a third sending module, used to send a design draft query request to a server so that the server obtains a design draft, wherein the design draft is used to guide code development so as to complete the construction of a code entity; a first receiving module, used to receive a design draft sent by the server, wherein the design draft is composed of multiple components; a fourth sending module, used to send a component conversion request to the server based on the design draft; and a second receiving module, used to receive a code snippet sent by the server that matches the component conversion request.
[0012] The fifth aspect of the present disclosure provides a development plug-in for a code development tool, including: a design draft query control and a component code conversion control; wherein the design draft query control is used to send a design draft query request to a server, so that the server returns the design draft after obtaining the design draft, wherein the design draft is used to guide code development so as to complete the construction of a code entity; the component code conversion control is used to send a component code conversion request to the server based on the design draft, so that the server returns a code snippet matching the component code conversion request.
[0013] A sixth aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0014] The seventh aspect of the present disclosure further provides a computer-readable storage medium having a computer program or instructions stored thereon, which implements the steps of the above method when the above computer program or instructions are executed by a processor.
[0015] The eighth aspect of the present disclosure also provides a computer program product, including a computer program or instructions, which implement the steps of the above method when the above computer program or instructions are executed by a processor.
[0016] According to an embodiment of the present disclosure, after receiving a design draft query request sent by a code development tool end, the design draft can be directly obtained based on the design identifier and the basic parameters of the design tool. When the design draft is received at the code development tool end and it is confirmed that there is a need for transcoding, the code snippet is obtained. Since the design draft can be viewed directly at the code development tool end. Therefore, the time for finding the design draft can be shortened, thereby shortening the development time and improving the code development efficiency. In addition, after viewing the design draft at the code development tool end, if there is a need for transcoding, the corresponding code snippet can be obtained in time, which simplifies the operation of obtaining the corresponding code and improves the code reuse rate. The present disclosure associates code development with viewing the design draft and the component transcoding of the design draft, so that code developers can view the design draft in time at the code development tool end, and reuse the code snippets corresponding to the available components in the design draft, layer by layer, and jointly improve the development efficiency, reduce the development difficulty and requirements for developers, and provide convenience for developers. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The above contents and other purposes, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0018] Figure 1 The application scenario diagram schematically shows the code reuse method, apparatus, development plug-in, device, medium and program product according to the embodiment of the present disclosure;
[0019] Figure 2 The flowchart of the code reuse method according to the embodiment of the present disclosure is schematically shown;
[0020] Figure 3 A schematic diagram of code reuse interaction according to an embodiment of the present disclosure is shown schematically;
[0021] Figure 4 A flowchart of a code reuse method according to another embodiment of the present disclosure is schematically shown;
[0022] Figure 5 A schematic diagram of a code development tool interface for installing a development plug-in according to an embodiment of the present disclosure is schematically shown;
[0023] Figure 6 The structure block diagram of the code multiplexing device according to the embodiment of the present disclosure is schematically shown;
[0024] Figure 7 A structural block diagram of a code multiplexing device according to another embodiment of the present disclosure is schematically shown; and
[0025] Figure 8 A block diagram of an electronic device suitable for implementing a code reuse method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0026] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0027] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0028] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0029] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0030] In the technical solution of the present disclosure, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0031] In the scenario of using personal information for automated decision-making, the methods, devices, and systems provided by the embodiments of the present disclosure provide users with corresponding operation portals for users to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered. The expression "automated decision-making" here refers to the activity of automatically analyzing and evaluating a person's behavioral habits, interests and hobbies, or economic, health, credit status, etc. through computer programs, and making decisions. The expression "expert decision-making" here refers to the activity of making decisions by people who specialize in a certain field, have specialized experience, knowledge and skills, and have reached a certain level of professionalism.
[0032] In the process of implementing the embodiments of the present disclosure, it was found that when the front-end developer needs to view the design draft designed by the designer to guide the code development during the code development process using the code development tool, since the design draft cannot be directly viewed in the code development tool, the developer needs to manually exit or run the code development tool in the background before manually searching for the design draft. Code development takes a long time, resulting in low code development efficiency, especially for large code development projects. In addition, although the existing interface design can be converted into code, the front-end developer still needs to manually exit or run the code development tool in the background before performing the code conversion operation, which is complicated and has a low code reuse rate.
[0033] An embodiment of the present disclosure provides a code reuse method, comprising: in response to a design draft query request sent by a code development tool end, obtaining a design identifier of the design draft and basic parameters of a design tool used to design the design draft, wherein the design draft is used to guide code development so as to complete the construction of a code entity; based on the design identifier and the basic parameters, obtaining the design draft, wherein the design draft is composed of multiple components; sending the design draft to the code development tool end so that the code development tool end sends a component code conversion request after receiving the design draft; in response to the component code conversion request, obtaining a code snippet matching the component code conversion request; and sending the code snippet to the code development tool end.
[0034] Figure 1 The application scenario diagram of the code reuse method, apparatus, development plug-in, device, medium and program product according to the embodiments of the present disclosure is schematically shown.
[0035] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0036] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as code development tools, shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0037] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0038] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0039] It should be noted that the code reuse method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the code reuse device provided in the embodiment of the present disclosure can generally be set in the server 105. The code reuse method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Correspondingly, the code reuse device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.
[0040] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0041] The following will be based on Figure 1 The scene described by Figure 2~Figure 5 The code reuse method of the disclosed embodiment is described in detail.
[0042] Figure 2 The flowchart of the code reuse method according to the embodiment of the present disclosure is schematically shown.
[0043] like Figure 2 As shown, the code reuse method of this embodiment includes operations S210 to S250, and the code reuse method can be executed by the server side.
[0044] In operation S210, in response to a design draft query request sent by the code development tool, a design identifier of the design draft and basic parameters of a design tool used to design the design draft are obtained.
[0045] In operation S220, a design draft is obtained based on the design identifier and the basic parameters.
[0046] In operation S230, the design draft is sent to the code development tool end, so that the code development tool end sends a component code conversion request after receiving the design draft.
[0047] In operation S240 , in response to the component transcoding request, a code segment matching the component transcoding request is acquired.
[0048] In operation S250 , the code snippet is sent to a code development tool.
[0049] According to an embodiment of the present disclosure, the code development tool end may include but is not limited to tools for code development, such as a code editor, etc. The design draft query request may be used to indicate that the developer needs to view the design draft. For example, the developer may send a design draft query request to the server by clicking a function control in the code editor.
[0050] According to an embodiment of the present disclosure, the design draft is used to guide code development so as to complete the construction of the code entity. The design draft is composed of multiple components. The design identifier may include a unique identifier for indicating the design draft. The design tool may include a tool for designing the design draft, which is not specifically limited in the present disclosure. The basic parameters may include, but are not limited to, an interface key, a storage location, user authentication information, etc. of the design tool.
[0051] According to an embodiment of the present disclosure, a design draft with a design identifier may be queried and acquired based on an interface key, a storage location, user authentication information, etc. of a design tool.
[0052] According to an embodiment of the present disclosure, after sending the design draft to the code development tool end, the code developer can select the associated components associated with the code development according to actual needs, and then send a component conversion request to the server end. The component conversion request may include but is not limited to the component identifier of the component to be converted.
[0053] According to an embodiment of the present disclosure, a design-to-code interface for design-to-code can be called according to a component-to-code request, and an associated component can be confirmed from a design draft according to a component identifier, and then a code snippet can be determined according to the properties of the associated component, etc. The properties of the associated component can include but are not limited to the type, position coordinates, size, and appearance properties of the associated component, etc.
[0054] According to an embodiment of the present disclosure, after receiving a design draft query request sent by a code development tool end, the design draft can be directly obtained based on the design identifier and the basic parameters of the design tool. When the design draft is received at the code development tool end and it is confirmed that there is a need for transcoding, the code snippet is obtained. Since the design draft can be viewed directly at the code development tool end. Therefore, the time for finding the design draft can be shortened, thereby shortening the development time and improving the code development efficiency. In addition, after viewing the design draft at the code development tool end, if there is a need for transcoding, the corresponding code snippet can be obtained in time, which simplifies the operation of obtaining the corresponding code and improves the code reuse rate. The present disclosure associates code development with viewing the design draft and the component transcoding of the design draft, so that code developers can view the design draft in time at the code development tool end, and reuse the code snippets corresponding to the available components in the design draft, layer by layer, and jointly improve the development efficiency, reduce the development difficulty and requirements for developers, and provide convenience for developers.
[0055] Figure 3A schematic diagram of code reuse interaction according to an embodiment of the present disclosure is schematically shown.
[0056] like Figure 3 As shown, the code reuse interaction in this embodiment may include operations S301 to S307.
[0057] In operation S301, the code development tool sends a design draft query request to the server.
[0058] In operation S302, the server side obtains the design identifier of the design draft and basic parameters of a design tool used to design the design draft in response to the design draft query request.
[0059] In operation S303, the server obtains the design draft based on the design identifier and basic parameters.
[0060] In operation S304, the server sends the design draft to the code development tool.
[0061] In operation S305, after receiving the design draft, the code development tool sends a component conversion request to the server.
[0062] In operation S306 , the server side obtains a code segment matching the component-to-code request from the code development tool side in response to the component-to-code request.
[0063] In operation S307 , the server sends the code snippet to the code development tool.
[0064] According to the embodiments of the present disclosure, through the interaction between the code development tool and the server, code developers can obtain the design draft and the code snippet of any component in the design draft in a timely manner according to needs when using the code development tool. Developers can reuse the code snippet, shorten the code development time, and reduce the development difficulty.
[0065] In the process of implementing the embodiments of the present disclosure, it is found that different websites, application systems, etc. need to have their own set of codes to complete development. Different websites and application systems are independent of each other and have no intersection. As a result, similar functions between different websites or different application systems need to develop their own corresponding proprietary codes. Therefore, a lot of repetitive work is caused for developers, resulting in low development efficiency and code reuse rate.
[0066] Based on this, another embodiment of the present disclosure may include the code reuse method as described above. Figure 2 In addition to the operations S210 to S250 shown, the method may further include: when it is determined that a custom configuration file exists on the code development tool side, storing a storage path of the custom configuration file.
[0067] According to an embodiment of the present disclosure, a custom configuration file is used to write association information of an associated design draft associated with a code. The association information may include, but is not limited to, a design identifier of the associated design draft, a tool identifier of a design tool for designing the associated design draft, and the like.
[0068] According to an embodiment of the present disclosure, when a developer is editing a code, he or she can set a custom configuration file on the code development tool side, write the associated information of the associated design draft associated with the code into the custom configuration file, and write the storage path of the custom configuration file into the code project created when editing the code.
[0069] According to an embodiment of the present disclosure, the code development tool end may be monitored by a monitoring thread, and when it is detected that a custom configuration file exists on the code development tool end, the storage path is stored.
[0070] According to the embodiments of the present disclosure, since the storage path of the custom configuration file is stored when the association information of the associated design draft associated with the code is written in the custom configuration file, the association information of the design draft is associated with the code, which enables developers to directly view the design draft on the code development tool side when developing projects with similar functions, saving time in searching for design drafts and improving code development efficiency.
[0071] According to the embodiments of the present disclosure, for the above Figure 2 The operation S210 shown, in response to a design draft query request sent by the code development tool end, obtains the design identifier of the design draft and the basic parameters of the design tool used to design the design draft, and may include the operations of: responding to the design draft query request sent by the code development tool end, reading a custom configuration file based on the storage path of the custom configuration file; parsing the design identifier and the tool identifier of the design tool from the custom configuration file; and calling an interface matching the tool identifier to obtain basic parameters.
[0072] According to an embodiment of the present disclosure, when the server receives a design draft query request sent by the code development tool, the server can read the custom configuration file from the storage path of the stored custom configuration file, and then parse and extract the design identifier and tool identifier. The interface matching the tool identifier can be called according to the tool identifier, and basic parameters can be obtained through the interface.
[0073] According to an embodiment of the present disclosure, an interface matching a tool identifier may obtain calling permission in advance.
[0074] According to the embodiments of the present disclosure, by reading a custom configuration file to extract design-related information, the design identifier of the design draft and the basic parameters of the design tool can be quickly and accurately obtained.
[0075] According to an embodiment of the present disclosure, the basic parameters may include storage setting parameters of the design tool. Figure 2 The operation S220 shown, obtaining the design draft based on the design identifier and the basic parameters, may include the operations of: determining the root directory file storing the design draft according to the storage setting parameters, and obtaining the design draft from the root directory file based on the design identifier.
[0076] According to an embodiment of the present disclosure, the storage setting parameters may include a default storage location for the design tool to store the design draft. The designer may store the design draft according to the default storage location, for example, by creating a new folder in the default storage location. The default storage location may be used as a root directory file of the design draft.
[0077] According to an embodiment of the present disclosure, after the root directory file is determined, a specific design draft can be located according to the design identifier, and then the design draft can be obtained.
[0078] According to the embodiments of the present disclosure, by combining the storage settings of a specific design tool, the root directory file is accurately determined, and then the design draft is obtained according to the design identifier. This can be applicable to design drafts designed by different design tools and has universality.
[0079] According to another embodiment of the present disclosure, the code reuse method may include the above Figure 2 In addition to the operations S210 to S250 shown, after the design draft is obtained, the operation may also include: configuring a design-to-code interface matching the component identifier for each component of the design draft.
[0080] According to the embodiments of the present disclosure, by configuring a design-to-code interface for each component of the design draft, it is convenient to obtain the corresponding code snippet by directly clicking any component of the design draft when viewing the design draft.
[0081] According to an embodiment of the present disclosure, the component transcoding request may include: a component identifier of the component to be converted. Figure 2 The operation S240 shown, in response to the component transcoding request, obtaining a code snippet matching the component transcoding request, may include the operation of: in response to the component transcoding request, calling a design transcoding interface matching the component identifier to obtain a code snippet matching the component transcoding request.
[0082] According to an embodiment of the present disclosure, after a code developer reviews a design draft, if he believes that a component in the design draft can be used for reuse or reference, he can trigger a component-to-code request sent to a server through a code development tool, call a design-to-code interface that matches the component identifier, implement the component-to-code operation, and obtain a code snippet.
[0083] According to the embodiment of the present disclosure, the design-to-code interface is not specifically limited in the present disclosure. The design-to-code interface can obtain a call permission in advance.
[0084] According to the embodiments of the present disclosure, by directly converting the code according to the corresponding interface called by the selected component, the code snippet can be obtained in time at the code development tool end, which shortens the code development time and improves the code development efficiency.
[0085] Figure 4 The following schematically shows a flow chart of a code reuse method according to another embodiment of the present disclosure.
[0086] like Figure 4 As shown, the code reuse method of this embodiment includes operations S410 to S440, and the code reuse method can be executed by a code development tool.
[0087] In operation S410, a design draft query request is sent to a server so that the server obtains the design draft.
[0088] In operation S420, a design draft sent by the server is received.
[0089] In operation S430, based on the design draft, a component transcoding request is sent to the server.
[0090] In operation S440 , a code segment matching the component transcoding request sent by the server is received.
[0091] According to an embodiment of the present disclosure, the design draft is used to guide code development so as to complete the construction of the code entity.
[0092] According to an embodiment of the present disclosure, the design draft is composed of multiple components.
[0093] It should be noted that the description of the code reuse method part executed by the code development tool side can be specifically referred to the code reuse method part executed by the server side, and will not be repeated here.
[0094] Figure 5 A schematic diagram of a code development tool interface for installing a development plug-in according to an embodiment of the present disclosure is schematically shown.
[0095] According to an embodiment of the present disclosure, a development plug-in of a code development tool may include: a design draft query control and a component code conversion control.
[0096] According to an embodiment of the present disclosure, a design draft query control can be used to send a design draft query request to a server, so that the server returns the design draft after obtaining the design draft, and the design draft can be used to guide code development to complete the construction of the code entity. A component code conversion control can be used to send a component code conversion request to a server based on the design draft, so that the server returns a code snippet matching the component code conversion request.
[0097] According to an embodiment of the present disclosure, a development plug-in of a code development tool may be installed in the code development tool, such as Figure 5 The code development tool interface 500 shown may include a design draft query control 501, a component code conversion control 502, and a code editing area 503. When a code developer is editing a code in the code editing area 503, he can obtain a design draft by clicking the design draft query control 501, and after viewing the design draft, he can obtain a code snippet by clicking the component code conversion control 502.
[0098] It should be noted that the above disclosure Figure 5 This is just a schematic illustration of how to use the plug-in, and does not limit the number, shape, and size of the design draft query control and component code conversion control of the present disclosure. The code development tool interface may also include components other than the query control 501, component code conversion control 502, and code editing area 503 in the above example.
[0099] Based on the above code reuse method executed by the server, the present disclosure also provides a code reuse device. Figure 6 The device is described in detail.
[0100] Figure 6 The structural block diagram of the code multiplexing device according to the embodiment of the present disclosure is schematically shown.
[0101] like Figure 6 As shown, the code multiplexing device 600 of this embodiment includes a first acquisition module 610 , a second acquisition module 620 , a first sending module 630 , a third acquisition module 640 and a second sending module 650 .
[0102] The first acquisition module 610 is used to respond to the design draft query request sent by the code development tool end, and obtain the design identifier of the design draft and the basic parameters of the design tool used to design the design draft, wherein the design draft is used to guide code development so as to complete the construction of the code entity. In one embodiment, the first acquisition module 610 can be used to perform the operation S210 described above, which will not be repeated here.
[0103] The second acquisition module 620 is used to acquire a design draft based on the design identifier and the basic parameters, wherein the design draft is composed of multiple components. In one embodiment, the second acquisition module 620 can be used to perform the operation S220 described above, which will not be repeated here.
[0104] The first sending module 630 is used to send the design draft to the code development tool end, so that the code development tool end sends a component code conversion request after receiving the design draft. In one embodiment, the first sending module 630 can be used to perform the operation S230 described above, which will not be repeated here.
[0105] The third acquisition module 640 is used to respond to the component transcoding request and acquire the code fragment matching the component transcoding request. In one embodiment, the third acquisition module 640 can be used to perform the operation S240 described above, which will not be described in detail here.
[0106] The second sending module 650 is used to send the code snippet to the code development tool end. In one embodiment, the second sending module 650 can be used to perform the operation S250 described above, which will not be repeated here.
[0107] According to an embodiment of the present disclosure, the code reuse device 600 may further include a storage module. The storage module is used to store the storage path of the custom configuration file when it is determined that the code development tool has a custom configuration file, wherein the custom configuration file is used to write the associated information of the associated design draft associated with the code.
[0108] According to an embodiment of the present disclosure, the first acquisition module 610 may include: a reading unit, a parsing unit, and a first calling unit. The reading unit is used to respond to a design draft query request sent by the code development tool end, and read the custom configuration file based on the storage path of the custom configuration file. The parsing unit is used to parse the design identifier and the tool identifier of the design tool from the custom configuration file. The first calling unit is used to call an interface matching the tool identifier to obtain basic parameters.
[0109] According to an embodiment of the present disclosure, the basic parameters may include storage setting parameters of the design tool. The second acquisition module 620 may include: a determination unit and a sub-acquisition unit. The determination unit is used to determine the root directory file storing the design draft according to the storage setting parameters. The sub-acquisition unit is used to acquire the design draft from the root directory file based on the design identifier.
[0110] According to an embodiment of the present disclosure, the component conversion request may include: a component identifier of the component to be converted. The third acquisition module 640 may include a second calling unit. The second calling unit is used to call a design conversion interface matching the component identifier in response to the component conversion request, so as to obtain a code fragment matching the component conversion request.
[0111] According to an embodiment of the present disclosure, any multiple modules of the first acquisition module 610, the second acquisition module 620, the first sending module 630, the third acquisition module 640, and the second sending module 650 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the first acquisition module 610, the second acquisition module 620, the first sending module 630, the third acquisition module 640, and the second sending module 650 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in a proper combination of any of them. Alternatively, at least one of the first acquisition module 610, the second acquisition module 620, the first sending module 630, the third acquisition module 640 and the second sending module 650 may be at least partially implemented as a computer program module, which may perform corresponding functions when executed.
[0112] Based on the above code reuse method executed by the code development tool end, the present disclosure also provides a code reuse device. Figure 7 The device is described in detail.
[0113] Figure 7 The structural block diagram of a code multiplexing device according to another embodiment of the present disclosure is schematically shown.
[0114] like Figure 7 As shown, the code multiplexing device 700 of this embodiment includes a third sending module 710 , a first receiving module 720 , a fourth sending module 730 and a second receiving module 740 .
[0115] The third sending module 710 is used to send a design draft query request to the server so that the server obtains the design draft, wherein the design draft is used to guide code development so as to complete the construction of the code entity. In one embodiment, the third sending module 710 can be used to perform the operation S410 described above, which will not be repeated here.
[0116] The first receiving module 720 is used to receive a design draft sent by the server, wherein the design draft is composed of multiple components. In one embodiment, the first receiving module 720 can be used to perform the operation S420 described above, which will not be repeated here.
[0117] The fourth sending module 730 is used to send a component transcoding request to the server based on the design draft. In one embodiment, the fourth sending module 730 can be used to perform the operation S430 described above, which will not be described in detail here.
[0118] The second receiving module 740 is used to receive a code segment sent by the server and matching the component transcoding request. In one embodiment, the second receiving module 740 can be used to perform the operation S440 described above, which will not be described in detail here.
[0119] According to an embodiment of the present disclosure, any multiple modules of the third sending module 710, the first receiving module 720, the fourth sending module 730, and the second receiving module 740 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the third sending module 710, the first receiving module 720, the fourth sending module 730, and the second receiving module 740 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, at least one of the third sending module 710 , the first receiving module 720 , the fourth sending module 730 , and the second receiving module 740 may be at least partially implemented as a computer program module, and when the computer program module is executed, a corresponding function may be executed.
[0120] Figure 8 A block diagram of an electronic device suitable for implementing a code reuse method according to an embodiment of the present disclosure is schematically shown.
[0121] like Figure 8As shown, the electronic device 800 according to an embodiment of the present disclosure includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 to a random access memory (RAM) 803. The processor 801 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include an onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0122] In RAM 803, various programs and data required for the operation of electronic device 800 are stored. Processor 801, ROM 802 and RAM 803 are connected to each other via bus 804. Processor 801 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 802 and / or RAM 803. It should be noted that the program can also be stored in one or more memories other than ROM 802 and RAM 803. Processor 801 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0123] According to an embodiment of the present disclosure, the electronic device 800 may further include an input / output (I / O) interface 805, which is also connected to the bus 804. The electronic device 800 may further include one or more of the following components connected to the input / output (I / O) interface 805: an input portion 806 including a keyboard, a mouse, etc.; an output portion 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 808 including a hard disk, etc.; and a communication portion 809 including a network interface card such as a LAN card, a modem, etc. The communication portion 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the input / output (I / O) interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that the computer program read therefrom is installed into the storage portion 808 as needed.
[0124] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0125] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 802 and / or RAM 803 described above and / or one or more memories other than ROM 802 and RAM 803.
[0126] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the method provided by the embodiment of the present disclosure.
[0127] The above functions defined in the system / device of the embodiment of the present disclosure are executed when the computer program is executed by the processor 801. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0128] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 809, and / or installed from a removable medium 811. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0129] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the processor 801, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0130] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0131] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0132] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations or combinations are not explicitly described in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0133] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A code reuse method, characterized in that: The method comprises: In response to a design draft query request sent by the code development tool end, a design identifier of the design draft and basic parameters of a design tool used to design the design draft are obtained, wherein the design draft is used to guide code development so as to complete the construction of a code entity; Based on the design identifier and the basic parameters, obtaining the design draft, wherein the design draft is composed of multiple components; Sending the design draft to the code development tool end, so that the code development tool end sends a component code conversion request after receiving the design draft; In response to the component transcoding request, obtaining a code fragment matching the component transcoding request; and The code snippet is sent to the code development tool end.
2. The method according to claim 1, characterized in that The method further comprises: When it is determined that a custom configuration file exists on the code development tool end, a storage path of the custom configuration file is stored, wherein the custom configuration file is used to write association information of an associated design draft associated with the code.
3. The method according to claim 2, characterized in that The step of obtaining, in response to the design draft query request sent by the code development tool end, a design identifier of the design draft and basic parameters of a design tool used to design the design draft includes: In response to the design draft query request sent by the code development tool, reading the custom configuration file based on the storage path of the custom configuration file; parsing the design identifier and the tool identifier of the design tool from the custom configuration file; and An interface matching the tool identifier is called to obtain the basic parameters.
4. The method according to claim 3, characterized in that The basic parameters include storage setting parameters of the design tool; The obtaining of the design draft based on the design identifier and the basic parameters includes: Determine the root directory file for storing the design draft according to the storage setting parameters; as well as Based on the design identifier, the design draft is obtained from the root directory file.
5. The method according to any one of claims 1 to 4, characterized in that: The component transcoding request includes: a component identifier of the component to be converted; The step of obtaining, in response to the component transcoding request, a code fragment matching the component transcoding request includes: In response to the component transcoding request, a design transcoding interface matching the component identifier is called to obtain the code snippet matching the component transcoding request.
6. A code reuse method, characterized in that: The method comprises: Sending a design draft query request to a server so that the server obtains a design draft, wherein the design draft is used to guide code development so as to complete the construction of a code entity; Receiving the design draft sent by the server, wherein the design draft is composed of multiple components; Based on the design draft, sending a component transcoding request to the server; and A code snippet matching the component transcoding request is received and sent by the server.
7. A code multiplexing device, characterized in that: The device comprises: A first acquisition module is used to respond to a design draft query request sent by a code development tool end, and acquire a design identifier of the design draft and basic parameters of a design tool used to design the design draft, wherein the design draft is used to guide code development so as to complete the construction of a code entity; A second acquisition module, configured to acquire the design draft based on the design identifier and the basic parameters, wherein the design draft is composed of multiple components; A first sending module, used to send the design draft to the code development tool end, so that the code development tool end sends a component code conversion request after receiving the design draft; A third acquisition module is used to respond to the component transcoding request and acquire a code segment matching the component transcoding request; and The second sending module is used to send the code snippet to the code development tool end.
8. A code multiplexing device, characterized in that: The device comprises: A third sending module is used to send a design draft query request to the server so that the server obtains the design draft, wherein the design draft is used to guide code development so as to complete the construction of the code entity; A first receiving module is used to receive the design draft sent by the server, wherein the design draft is composed of multiple components; A fourth sending module, configured to send a component transcoding request to the server based on the design draft; and The second receiving module is used to receive a code fragment sent by the server and matching the component transcoding request.
9. A development plug-in for a code development tool, including a design draft query control and a component code conversion control; in, The design draft query control is used to send a design draft query request to the server, so that the server returns the design draft after obtaining the design draft, wherein the design draft is used to guide code development so as to complete the construction of the code entity; The component transcoding control is used to send a component transcoding request to the server based on the design draft, so that the server returns a code fragment matching the component transcoding request.
10. An electronic device, comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 6.
11. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
12. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.