WO2023173631A1 - 编程方法和装置、设备、存储介质及计算机程序产品 - Google Patents

编程方法和装置、设备、存储介质及计算机程序产品 Download PDF

Info

Publication number
WO2023173631A1
WO2023173631A1 PCT/CN2022/104119 CN2022104119W WO2023173631A1 WO 2023173631 A1 WO2023173631 A1 WO 2023173631A1 CN 2022104119 W CN2022104119 W CN 2022104119W WO 2023173631 A1 WO2023173631 A1 WO 2023173631A1
Authority
WO
WIPO (PCT)
Prior art keywords
code
module
definition file
user
code module
Prior art date
Application number
PCT/CN2022/104119
Other languages
English (en)
French (fr)
Inventor
邹雨竹
耿胜红
Original Assignee
上海商汤智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 上海商汤智能科技有限公司 filed Critical 上海商汤智能科技有限公司
Publication of WO2023173631A1 publication Critical patent/WO2023173631A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30181Instruction operation extension or modification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Definitions

  • the present disclosure relates to the field of artificial intelligence technology, and in particular to a programming method and device, equipment, storage media and computer program products.
  • Embodiments of the present disclosure provide a programming method and device, equipment, storage media and computer program products.
  • the embodiment of the present disclosure provides a programming method, including: obtaining at least one code module about a target project, each code module corresponding to at least one code segment; displaying a selection interface of at least one code module; responding to the user passing the selection interface A selection instruction for a code module displays the code segment of the selected code module, where the displayed code segment can be edited.
  • Embodiments of the present disclosure provide a programming device, which includes: an acquisition part configured to acquire at least one code module corresponding to the target project, each code module corresponding to at least one code segment; a first display part, A selection interface configured to display at least one code module; the second display part is configured to display a code segment of the selected code module in response to a user's selection instruction of the code module through the selection interface, wherein the displayed code segment can be edit.
  • Embodiments of the present disclosure provide an electronic device, including a memory and a processor.
  • the processor is connected to the memory and configured to execute program instructions stored in the memory to implement the above programming method.
  • Embodiments of the present disclosure provide a computer-readable storage medium on which program instructions are stored. When the program instructions are executed by a processor, the above programming method is implemented.
  • Embodiments of the present disclosure provide a computer program product.
  • the computer program product includes a computer program or instructions.
  • the computer program or instructions When the computer program or instructions are run on an electronic device, the electronic device executes the above programming method.
  • Figure 1 is a schematic flow chart of a programming method provided by an embodiment of the present disclosure
  • Figure 2 is a schematic diagram of some files included in a target project in a programming interface provided by an embodiment of the present disclosure
  • Figure 3 is a schematic diagram of the content structure of a definition file provided by an embodiment of the present disclosure.
  • Figure 4 is a schematic diagram of a programming interface including a selection interface provided by an embodiment of the present disclosure
  • Figure 5 is a schematic structural diagram of a programming device provided by an embodiment of the present disclosure.
  • Figure 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • FIG. 7 is a schematic structural diagram of a computer-readable storage medium provided by an embodiment of the present disclosure.
  • a and/or B in this article is an association relationship that describes related objects, indicating that there can be three relationships.
  • a and/or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. these three situations.
  • the character "/" in this article generally indicates that the related objects are an "or” relationship.
  • "many” in this article means two or more than two.
  • the term "at least one” herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, and C, which can mean including from A, Any one or more elements selected from the set composed of B and C.
  • Figure 1 is a schematic flow chart of a programming method provided by an embodiment of the present disclosure. As shown in Figure 1, the method includes steps S11 to step S13, wherein:
  • Step S11 Obtain at least one code module about the target project, and each code module corresponds to at least one code segment.
  • the target project can be any project that needs to be programmed.
  • At least one code segment in the code module can be used to implement one or more functions in the target project.
  • the target project is a face detection project.
  • the face detection project needs to be implemented through several code segments. Some or all of the code segments can be divided to obtain at least one code module.
  • the target project can be a programming experiment designed by the teacher using the teaching experiment platform according to the course during the teaching process.
  • Step S12 Display a selection interface for at least one code module.
  • the selection interface may display all code modules related to the target project, or may display some code modules related to the target project.
  • Step S13 In response to the user's selection instruction of the code module through the selection interface, display the code segment of the selected code module, where the displayed code segment can be edited.
  • the user can select one or more code modules through the displayed selection interface, and the code segments corresponding to the selected code modules will be displayed in the selection interface.
  • the code segment corresponding to the selected code module is displayed in the code editing area of the selection interface, and the user can enter code in the code editing area or edit the displayed code.
  • step S11 may include steps S111 to S112, wherein:
  • Step S111 Obtain a definition file set about the target project.
  • Each definition file in the definition file set includes at least one code module.
  • Step S112 Based on the definition file set, obtain at least one code module related to the target project.
  • the definition file set includes at least one definition file.
  • the content structure of the definition file may include the following: a file identifier of the definition file, a module identifier of at least one code module included, and a code fragment corresponding to each code module. That is to say, the following content can be defined in the definition file: the file identifier of the definition file, the module identifier including at least one code module, and the code fragment corresponding to each code module.
  • the file identifier may be a file name, and the module identifier of the code module may be the name of the code module.
  • Each definition file can include one or more code modules, and each code module can have one or more code fragments corresponding to it.
  • description information of each code module may also be defined in the definition file, and the description information is used to indicate information such as functions used to be implemented by the code module.
  • the definition file about the target project may be defined by the producer of the target project.
  • the user can edit and update the definition file of the target project.
  • the user is the producer of the target project
  • As an experimenter the user can perform programming operations on the target project based on the code modules defined in the target project's definition file.
  • the producer of the target project is the teacher
  • the experimenter of the target project is the student.
  • the teacher can make one or more definition files for the target project according to the needs of the course design, and the students can use the definition file about the target project designed by the teacher to define Code module for programming.
  • the user does not have permission to edit or update the definition file about the target project.
  • the producer of the target project by placing the code module in the definition file, it is convenient for the producer of the target project to extend and supplement the code module of the target project, so that the producer of the target project can conveniently produce the code module for the target project. and the code segments corresponding to each code module.
  • the method before the above step S11, the method further includes steps S101 to S102, wherein:
  • Step S101 Receive a user's creation instruction to create a definition file for the target project.
  • Step S102 In response to the creation instruction, create a definition file and store the definition file created by the user in a default directory.
  • the target project before receiving the user's creation instruction to create a definition file for the target project, in the programming system, the target project may also be created in response to the user's instruction to create the target project.
  • Figure 2 is a schematic diagram of some files included in a target project in a programming interface provided by an embodiment of the present disclosure.
  • the name of the target project is AI sample experiment
  • 21 is a preset for storing definition files in the target project.
  • 22 is the code segment
  • 23 is the code segment
  • 24 is the file directory of other files in the target project
  • 25 is a control used to display more definition files or create definition files.
  • the name of the default directory 21 is "snippet_defs”.
  • a definition file named "openapi.json” and a definition file named "common.json” are displayed under the default directory 21.
  • the content defined in the definition file can be Actual requirements editor.
  • the corresponding definition file is formed by editing the code segment 22 or the code segment 23 in FIG. 2 .
  • Each definition file includes at least one code module.
  • Figure 3 is a schematic diagram of the content structure of a definition file provided by an embodiment of the present disclosure.
  • 31 is a definition file named "common”
  • 32 is a definition file named "openapi”.
  • the definition file common includes two code modules, namely "io_read” and “oss_read”
  • the definition file openapi also includes two code modules, namely "face detect” and "object detect”.
  • each code module corresponds to at least one code segment, that is, each code module corresponds to at least one experimental code segment.
  • the code modules of each target project can be considered to be combined into a drawer, and the drawer can include one or more groups of visual code modules.
  • a group of visual code modules corresponds to a definition file, that is, the name of each definition file is the name of a group of visual code modules.
  • the meaning of the drawer can be understood as that by clicking on the corresponding definition file name, the user can display the code modules under the definition file or collapse the displayed code modules.
  • the file directory 24 is named “Experimental Files” and can be used to store various types of files related to the target project, for example, including definition files, image files, project description files, User code files, etc.
  • the "usercode.py” file under file directory 24 in Figure 2 is used to store several definition files about the target project. Each definition file under this file has the same content structure information as the corresponding definition file under the default directory.
  • the "experiment file” can be imported by the user into a file corresponding to the target project, or the definition file in the "experiment file” can be generated from a definition file created by the user.
  • the corresponding definition file is generated in the file directory of "Experimental File” based on the definition file created by the user.
  • the definition file in the file directory of "Experimental File” can be provided to the target Used by the project's experimenter when programming the target project.
  • the definition file under the experimental file is correspondingly deleted.
  • the user can create, update, or delete the definition file of the target project in the preset directory, and then generate an "experimental file” based on the definition file in the preset directory, that is, the definition file under the experimental file is the same as the preset one.
  • the programming interface will display the contents of the experimental file accordingly.
  • the programming interface can be understood as the interface for the current programming operation. For example, by clicking on the "usercode.py" file, the programming interface can display a selection interface for at least one code module of the target project, so that programming can be performed according to the corresponding code segment.
  • the user when the user is the producer of the target project, the user can select the definition file in the preset directory and display a selection interface for at least one code module of the target project in the code editing area, so that the user can select the target project according to the corresponding code snippet for programming.
  • the user's instruction to create a definition file for the target project before acquiring at least one code module corresponding to the target project, receiving the user's instruction to create a definition file for the target project, and then responding to the instruction to create a definition file for the target project and storing the created definition file in
  • the default directory allows users to create corresponding code modules for different projects to suit different project requirements or different programming languages.
  • the method further includes steps S103 to S105, wherein:
  • Step S103 Based on the user's selection instruction for the definition file in the default directory, display the content structure of the definition file.
  • Step S104 Receive the user's instruction to modify the content structure of the definition file.
  • Step S105 In response to the modification instruction, modify the content structure of the definition file.
  • the user can display the content structure of the selected definition file in the code editing area, so that the user can edit and update the content structure of the definition file.
  • the file name of the definition file, the name of at least one included code module, the code fragment corresponding to each code module, and the description information of each definition file or each code module may be displayed in the code editing area.
  • the content structure of the definition file may be as follows:
  • the name of the definition file is "openapi"
  • the name of the code module is "face detect”
  • the description information of the definition file is the same as the description information of the code module, which is "This is a demo api”.
  • each code module may have corresponding description information.
  • the user can also click the control 25, which is named "More definitions", to display more definition files or create a definition file.
  • the user's instruction to modify the content structure of the definition file may be the user's editing operation on the content structure of the definition file displayed in the code editing area.
  • the content structure of the definition file is modified, and in response to the user's The save operation saves modifications to the content structure of the definition file.
  • the default directory will not be displayed on the user's system display interface. Only the "Experimental Files" directory is displayed, or although a preset directory is displayed on the user's system display interface, the files in the preset directory are not editable, so that users can program based on the code module of the target project.
  • the user is the producer of the target project (for example, a teacher)
  • the user's system display interface will display the default directory and the "experiment file” directory, and the files in the default directory can be edited so that the user can edit the preset directory. Edit and update the definition files in the "Experimental Files" directory, and use the code modules in the "Experimental Files" directory to demonstrate programming to students.
  • the content structure of the definition file is displayed based on the user's instruction to select the definition file in the preset directory, and the content structure of the definition file is modified based on the user's instruction to modify the content structure of the definition file. , thus making it convenient for users to edit and update these definition files at any time.
  • the programming method further includes steps S14 to S15, wherein:
  • Step S14 In response to the user's creation instruction for the target code fragment selected in the code editing area, create a new code module based on the target code fragment.
  • Step S15 Save the new code module into an existing or newly created definition file.
  • the existing definition file refers to a definition file that includes at least one code module
  • the newly created definition file refers to a definition file that does not include a code module.
  • the user edited code segment 22 and code segment 23 in the code editing area By selecting code segment 22 or code segment 23, the user can drag and drop it to the definition file named "openapi.json" , or by right-clicking the mouse, etc., and following the prompts to generate a creation instruction, and add the selected code segment to the existing definition file or a new definition file, as a code segment for the new code module or for the existing code module. code snippet.
  • the selected code segment can use the selected code segment as a new code segment for an existing code module in an existing definition file, or to replace the existing code segment of the code module, or to use the selected code segment as a new code segment for an existing definition file.
  • the content structure information of the definition file (for example, the module identification, description information, etc. of the new code module) is set by the user or is based on a preset The method determines the content structure information of the definition file.
  • the instruction information for prompting the user to set the content structure information of the definition file is displayed so that the user can input the content structure information of the definition file according to the instruction information.
  • the user inputs the identification of the code module and the description of the code module according to the prompt information. information or add description information to the definition file.
  • semantic analysis is performed on the code segments in the code module to determine the name of the code module, description information of the code module, etc.
  • the code module by defining the file identifier of the definition file, the module identifier of at least one code module, and the code fragments corresponding to each code module, it is easy for users to edit and edit information such as code modules and code fragments of each code module. renew.
  • the code module can be quickly created.
  • step S12 may include step S121, wherein:
  • Step S121 Display the module identification of at least one code module in the module selection area of the selection interface.
  • step S13 may include step S131, wherein:
  • Step S131 In response to the user's selection instruction for the module identifier of the code module in the module selection area, display the code segment of the selected code module in the code editing area of the selection interface.
  • FIG. 4 is a schematic diagram of a programming interface including a selection interface provided by an embodiment of the present disclosure.
  • the selection interface includes a target project 410, a module selection area 420, a code editing area 430, and a dialog box 440 that displays input values.
  • the module selection area 420 displayed in the selection interface includes the definition file identifiers "common” and “openapi”, as well as the module identifiers "io_read” and "oss_read” of the two code modules included under the definition file identifier "common”, the definition file
  • the module identifiers "face detect” and "object detect” identify the two code modules included under "openapi".
  • definition file identifier "common” and the two module identifiers "io_read” and “oss_read” are a set of visual code modules, corresponding to a definition file “common.json”.
  • definition file identifier "openapi” and the two module identifiers "face detect” and “object detect” are a set of visual code modules, corresponding to a definition file “openapi.json”.
  • the user can display the code segment of the selected code module in the code editing area. As shown in Figure 4, when the user clicks on the "face detect" code module in the module selection area 420, the code segment corresponding to the code module is displayed in the code editing area 430.
  • the code editing of the selection interface can be performed
  • the area displays the code segments of the selected code module, forming a drawer-style code visualization.
  • the method further includes steps S16 to S17, wherein:
  • Step S16 In response to the existence of the variable in the code segment, display an identification prompting the user to input the value of the variable.
  • Step S17 In response to receiving the value of the variable input by the user, fill in the value of the variable in the code segment of the selected code module.
  • the identifier used to prompt the user to enter the variable value may be a dialog box.
  • the user can be prompted to enter the value of the variable using a dialog box, or the user can be prompted to enter the variable by using different color prompts for the variable or using other indication information. value.
  • a dialog box for the user to input the value of the variable is displayed, and based on the value of the variable input by the user, the value of the variable is prompted in the corresponding code segment.
  • the dialog box to prompt the user to enter the value of the variable in the dialog box, it is convenient to explicitly input the variable value in the interactive mode of the dialog box and reduce errors caused by directly changing the code.
  • the programming system can automatically read the definition file about the target project and generate a selection interface including at least one code module.
  • the user clicks on the module identifier of one or more code modules to combine code segments in the code editing area, and can complete the target project based on the combination of code segments.
  • the target project is an experimental project.
  • the formulated code snippets can be generated at any time into code modules and saved to the definition file, and then passed Definition files can also be used to edit or update these code snippets.
  • the programming system can generate a selection interface in the system experimental operation interface based on the definition file in the experimental project.
  • the module identification is displayed in the selection interface. Students can click the module identification to display the corresponding code segments in the code editing area and combine each code segment. Complete the corresponding experiments. In this way, students can complete the filling and writing of more complex codes, improving learning efficiency and self-learning ability.
  • teachers can customize corresponding code modules for each experimental project at any time according to their needs, so as to be suitable for different experimental needs and different programming languages. In other words, the programming language of each code module may be the same or different.
  • the execution subject of the programming method may be a programming system or programming device, where the programming system or programming device may be applied to terminal equipment, servers, or other processing equipment, or a combination of the above equipment.
  • the terminal device can be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computing device, a vehicle-mounted device, or a portable device. Wearable devices, etc.
  • the programming method may be implemented by a processor invoking computer-readable instructions stored in a memory.
  • the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process.
  • the specific execution order of each step should be based on its function and possible The internal logic is determined.
  • the embodiment of the present disclosure provides a programming device corresponding to the programming method. Since the principle of solving the problem of the device in the embodiment of the present disclosure is similar to the above-mentioned method of the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method.
  • FIG. 5 is a schematic structural diagram of a programming device provided by an embodiment of the present disclosure.
  • the programming device 50 includes an acquisition part 51 , a first display part 52 and a second display part 53 .
  • the acquisition part 51 is configured to acquire at least one code module corresponding to the target project, and each code module corresponds to at least one code segment;
  • the first display part 52 is configured to display a selection interface of at least one code module
  • the second display part 53 is configured to display the code segment of the selected code module in response to the user's selection instruction of the code module through the selection interface, wherein the displayed code segment can be edited.
  • the acquisition part 51 is also configured to: acquire a set of definition files about the target project, each definition file in the set of definition files includes at least one code module; based on the set of definition files, obtain a set of definition files about the target project. at least one code module.
  • the first display part 52 is also configured to: display the module identification of at least one code module in the module selection area of the selection interface; the second display part 53 is also configured to: respond to When the user selects the module identifier of the code module in the module selection area, the code segment of the selected code module is displayed in the code editing area of the selection interface.
  • the acquisition part 51 is further configured to: receive a creation instruction from the user to create a definition file for the target project; in response to the creation instruction, create the definition file and store the definition file created by the user in a preset directory.
  • the acquisition part 51 is also configured to: display the content structure of the definition file based on the user's selection instruction for the definition file in the preset directory; receive the user's modification instruction for the content structure of the definition file; In response to the modification instruction, the content structure of the definition file is modified.
  • the content structure of the definition file includes the file identifier of the definition file, the module identifier of at least one code module, and the code fragment corresponding to each code module; and/or the acquisition part 51 is also configured to: In response to the user's creation instruction for the target code fragment selected in the code editing area, create a new code module based on the target code fragment; save the new code module to an existing or newly created definition file.
  • the second display part 53 is also configured to: in response to the presence of a variable in the code segment, display an identification for prompting the user to input the value of the variable; in response to receiving a user input in the dialog box The value of the variable, fill in the value of the variable in the code segment of the selected code module.
  • part may be part of a circuit, part of a processor, part of a program or software, etc., of course, it may also be a unit, it may be a module or it may be non-modular.
  • FIG. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • the electronic device 60 includes a memory 61 and a processor 62.
  • the processor 62 is connected to the memory 61.
  • the processor 62 is used to execute program instructions stored in the memory 61 to implement the steps in any of the above programming method embodiments.
  • the electronic device 60 may include but is not limited to: programming equipment, microcomputers, desktop computers, and servers.
  • the electronic device 60 may also include mobile devices such as laptop computers and tablet computers, which are not limited here.
  • the processor 62 is used to control itself and the memory 61 to implement the steps in any of the above programming method embodiments.
  • the processor 62 may also be called a CPU (Central Processing Unit).
  • the processor 62 may be an integrated circuit chip with signal processing capabilities.
  • the processor 62 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field-Programmable Gate Array, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
  • the processor 62 may be implemented by an integrated circuit chip.
  • Embodiments of the present disclosure also provide a computer-readable storage medium.
  • Program instructions are stored on the computer-readable storage medium. When the program instructions are executed by a processor, the steps in the above programming method embodiment are implemented.
  • the storage medium may be a volatile or non-volatile computer-readable storage medium.
  • FIG. 7 is a schematic structural diagram of a computer-readable storage medium provided by an embodiment of the present disclosure.
  • the computer-readable storage medium 70 stores program instructions 71.
  • the program instructions 71 are executed by the processor, the steps in any of the above-mentioned programming method embodiments are implemented.
  • the functions or parts included in the system provided by the embodiments of the present disclosure can be used to perform the methods described in the above method embodiments.
  • reference can be made to the description of the above method embodiments.
  • Embodiments of the present disclosure also provide a computer program product, which includes computer instructions or instructions.
  • the computer program product can be any product that can implement the above-mentioned programming method.
  • Some or all of the solutions in the computer program product that contribute to the existing technology can be in the form of software products (such as Software Development Kit (SDK))
  • SDK Software Development Kit
  • the software product can be stored in a storage medium, and the computer instructions contained therein cause the relevant device or processor to execute part or all of the steps of the above programming method.
  • the disclosed methods and systems can be implemented in other ways.
  • the system implementation described above is schematic.
  • the division of parts or units is a logical functional division.
  • units or components may be combined or integrated into another unit.
  • a system, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the system or unit may be in electrical, mechanical or other forms.
  • each functional unit in various embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above integrated units can be implemented in the form of hardware or software functional units. Integrated units may be stored in a computer-readable storage medium if implemented in the form of software functional units and sold or used as independent products.
  • the technical solution of the present disclosure is essentially or contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including a number of instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the various implementation methods of the present disclosure.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program code. .
  • Embodiments of the present disclosure provide a programming method and device, equipment, storage media and computer program products, wherein the programming method includes: obtaining at least one code module related to the target project, each code module corresponding to at least one code segment. ; Display a selection interface for at least one code module; in response to a user's selection instruction for a code module through the selection interface, display a code segment of the selected code module, wherein the displayed code segment can be edited.

Landscapes

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

Abstract

本公开实施例提供了一种编程方法和装置、设备、存储介质和计算机程序产品,其中,该编程方法包括:获取关于目标项目的至少一个代码模块,每一代码模块分别对应有至少一个代码段;显示至少一个代码模块的选择界面;响应于用户通过选择界面对代码模块的选择指令,显示选择的代码模块的代码段,其中,显示的代码段可被编辑。

Description

编程方法和装置、设备、存储介质及计算机程序产品
相关申请的交叉引用
本公开实施例基于申请号为202210254504.0、申请日为2022年03月15日、申请名称为“编程方法和***、设备、存储介质”的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本公开作为参考。
技术领域
本公开涉及人工智能技术领域,特别是涉及一种编程方法和装置、设备、存储介质及计算机程序产品。
背景技术
目前,计算机编程教育作为信息科技教育的一个重要组成部分。相关技术中,常见的程序语言都具备一定的专业性,因此编程具有一定的学习门槛,且不具有普适性。
发明内容
本公开实施例提供一种编程方法和装置、设备、存储介质及计算机程序产品。
本公开实施例提供了一种编程方法,包括:获取关于目标项目的至少一个代码模块,每一代码模块分别对应有至少一个代码段;显示至少一个代码模块的选择界面;响应于用户通过选择界面对代码模块的选择指令,显示选择的代码模块的代码段,其中,显示的代码段可被编辑。
本公开实施例提供了一种编程装置,所述装置包括:获取部分,被配置为获取关于目标项目对应的至少一个代码模块,每一代码模块分别对应有至少一个代码段;第一显示部分,被配置为显示至少一个代码模 块的选择界面;第二显示部分,被配置为响应于用户通过选择界面对代码模块的选择指令,显示选择的代码模块的代码段,其中,显示的代码段可被编辑。
本公开实施例提供了一种电子设备,包括存储器和处理器,处理器连接存储器,用于执行存储器中存储的程序指令,以实现上述编程方法。
本公开实施例提供了一种计算机可读存储介质,其上存储有程序指令,程序指令被处理器执行时实现上述编程方法。
本公开实施例提供了一种计算机程序产品,该计算机程序产品包括计算机程序或指令,在计算机程序或指令在电子设备上运行的情况下,使得电子设备执行上述编程方法。
在本公开实施例中,通过获取关于目标项目的至少一个代码模块,并显示代码模块的选择界面,然后可以根据用户通过选择界面对代码模块的选择指令,显示对应的代码段,一方面,实现了代码可视化,从而降低了用户的编程难度;另一方面,该编程方式可以适应于不同用户,从而提高了编程的普适性。
应当理解的是,以上的一般描述和后文的细节描述是示例性和解释性的,而非限制本公开。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。
图1为本公开实施例提供的一种编程方法的流程示意图;
图2为本公开实施例提供的一种编程界面中目标项目包括的部分文件的示意图;
图3为本公开实施例提供的一种定义文件的内容结构的示意图;
图4为本公开实施例提供的一种编程界面包括选择界面的示意图;
图5为本公开实施例提供的一种编程装置的组成结构示意图;
图6为本公开实施例提供的一种电子设备的结构示意图;
图7为本公开实施例提供的一种计算机可读存储介质的结构示意图。
具体实施方式
下面结合说明书附图,对本公开实施例的方案进行详细说明。
以下描述中,为了说明而不是为了限定,提出了诸如特定***结构、接口、技术之类的具体细节,以便透彻理解本公开。
本文中术语“和/或”,是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。此外,本文中的“多”表示两个或者多于两个。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。
目前,计算机编程教育作为信息科技教育的一个重要组成部分。相关技术中,常见的程序语言都具备一定的专业性,因此编程具有一定的学习门槛。不同学龄段、文理科的学生对程序语言的敏感性和掌握能力差异比较大。相关技术中,可视化编程能较大的降低编程门槛。常见的可视化编程方式有积木编程,积木编程主要面向低年龄段,例如,小学。而相对于初高中、院校类则不太适合。另一种常见的可视化编程类似绘制线框图,***根据绘制的线框图生成相应的执行脚本或代码,这种方案研发成本较高,对编程实验开发者的要求也比较高,不太适合一线教师采用这种方式来可视化实验代码。因此,亟需一种既能降低编程难度、又具有普适性的编程方式。
图1为本公开实施例提供的一种编程方法的流程示意图,如图1所 示,所述方法包括步骤S11至步骤S13,其中:
步骤S11:获取关于目标项目的至少一个代码模块,每一代码模块分别对应有至少一个代码段。
这里,目标项目可以是任何需要进行编程实现的项目。代码模块中的至少一个代码段能够用于实现目标项目中一个或多个功能。例如,该目标项目为人脸检测项目,进行人脸检测项目需要通过若干代码段实现,可以将部分或全部代码段进行划分,得到至少一个代码模块。在一些应用场景中,该目标项目可以是老师在教学过程中根据课程利用教学实验平台设计的编程实验。
步骤S12:显示至少一个代码模块的选择界面。
这里,选择界面中可以显示关于该目标项目的所有代码模块,也可以显示关于目标项目的部分代码模块。在一些应用场景中,为了增加教学的多样性或考察学生对代码运用的掌握情况,可以选择隐藏关于目标项目的部分代码模块,让学生在缺少该部分代码模块的情况下进行编程。
步骤S13:响应于用户通过选择界面对代码模块的选择指令,显示选择的代码模块的代码段,其中,显示的代码段可被编辑。
这里,用户可以通过显示的选择界面选择一个或多个代码模块,选择界面中即会显示被选择的代码模块对应的代码段。在一些实施方式中,将被选择的代码模块对应的代码段显示在选择界面的代码编辑区域,用户可以在代码编辑区域输入代码或对显示的代码进行编辑。
在本公开实施例中,通过获取关于目标项目的至少一个代码模块,并显示代码模块的选择界面,然后可以根据用户通过选择界面对代码模块的选择指令,显示对应的代码段,一方面,实现了代码可视化,从而降低了用户的编程难度;另一方面,该编程方式可以适应于不同用户,从而提高了编程的普适性。
在一些实施方式中,上述步骤S11可以包括步骤S111至步骤S112,其中:
步骤S111:获取关于目标项目的定义文件集,定义文件集中的每一定义文件中包括至少一个代码模块。
步骤S112:基于定义文件集,得到关于目标项目的至少一个代码模块。
这里,定义文件集中包括至少一个定义文件。在一些实施方式中,该定义文件的内容结构可以包括以下内容:定义文件的文件标识、包含的至少一个代码模块的模块标识以及每一代码模块对应的代码片段。也就是说,在定义文件中可以定义以下内容:定义文件的文件标识、包含至少一个代码模块的模块标识以及每一代码模块对应的代码片段。其中,文件标识可以是文件名称,代码模块的模块标识可以是代码模块的名称。每个定义文件中可以包括一个或多个代码模块,每个代码模块对应的代码片段可以是一个也可以是多个。在一些实施方式中,在定义文件中还可定义每一代码模块的描述信息,该描述信息用于指示该代码模块用于实现的功能等信息。
在一些实施方式中,关于目标项目的定义文件可以是由目标项目的制作者定义的,在用户为目标项目的制作者时,用户可以对目标项目的定义文件进行编辑更新,在用户为目标项目的实验者时,用户可以基于目标项目的定义文件定义的代码模块进行目标项目的编程操作。例如,目标项目的制作者为老师,目标项目的实验者为学生,老师可以根据课程设计的需求为目标项目制作一个或多个定义文件,学生可以使用老师设计的关于目标项目的定义文件定义的代码模块进行编程。在一些应用场景中,用户为目标项目的实验者时,用户没有编辑或更新关于目标项目的定义文件的权限。
在本公开实施方式中,通过将代码模块放置于定义文件中,方便目标项目的制作者对目标项目的代码模块进行扩展和补充,使得目标项目的制作者可以方便地制作关于目标项目的代码模块及各代码模块对应的代码段。
在一些实施方式中,在上述步骤S11之前,所述方法还包括步骤S101至步骤S102,其中:
步骤S101:接收用户为目标项目创建定义文件的创建指令。
步骤S102:响应于创建指令,创建定义文件并将用户创建的定义文件存放于预设目录。
在一些实施方式中,在接收用户为目标项目创建定义文件的创建指令之前,在编程***中,还可响应于用户创建目标项目的指令,创建目标项目。
图2为本公开实施例提供的一种编程界面中目标项目包括的部分文件的示意图,如图2所示,该目标项目的名称为AI示例实验,21为该目标项目中定义文件存放的预设目录,22为代码段,23为代码段,24为该目标项目中其它文件的文件目录,25为一控件,用于显示更多的定义文件,或创建定义文件。该预设目录21的名称为“snippet_defs”,在预设目录21下显示了名称为“openapi.json”的定义文件以及名称为“common.json”的定义文件,定义文件中定义的内容可根据实际需求编辑。例如,通过编辑图2中的代码段22或代码段23形成对应的定义文件。每个定义文件中包括至少一个代码模块。
图3为本公开实施例提供的一种定义文件的内容结构示意图,如图3所示,31为名称为“common”的定义文件,32为名称为“openapi”的定义文件。其中,定义文件common中包括两个代码模块,分别是“io_read”以及“oss_read”,定义文件openapi中也包括两个代码模块,分别是“face  detect”以及“object detect”。其中,每个代码模块对应至少一个代码段,即,每个代码模块至少对应一段实验代码。在一些实施方式中,可以认为每个目标项目的代码模块组合为一个抽屉,该抽屉可包括一组或多组可视化码模块。其中,一组可视化代码模块对应一个定义文件,即,每个定义文件的名称即为一组可视化代码模块的名称。抽屉的含义可以理解为用户通过点击对应的定义文件名称,能够显示该定义文件下的代码模块或将已显示的代码模块折叠。
在一些实施方式中,如图2所示,该文件目录24的名称为“实验文件”,可用于存放关于目标项目的各种类型的文件,例如,包括定义文件、图像文件、项目描述文件、用户代码文件等。例如,如图2中文件目录24下的“usercode.py”文件用于存放关于目标项目的若干个定义文件,该文件下的各定义文件与预设目录下对应的定义文件的内容结构信息相同。在一些实施方式中,该“实验文件”可以由用户导入目标项目对应的文件,或由用户创建的定义文件生成“实验文件”中的定义文件。例如,用户在预设目录下创建一个定义文件之后,基于用户创建的定义文件在“实验文件”的文件目录下生成对应的定义文件,“实验文件”的文件目录下的定义文件能够提供给目标项目的实验者进行目标项目编程时使用。在一些实施方式中,用户若删除预设目录下的定义文件之后,对应删除实验文件下的定义文件。在一些实施方式中,用户可以在预设目录下创建、更新、删除目标项目的定义文件,然后,基于预设目录下的定义文件生成“实验文件”,即,实验文件下的定义文件与预设目录下的定义文件相同。例如,用户在预设目录下创建或变更定义文件时,对应在“usercode.py”文件下创建或变更对应的定义文件。用户通过点击等选择操作选择相关实验文件后,编程界面会对应显示实验文件的内容。编程界面可以理解为当前编程操作的界面。例如,用户通过点击 “usercode.py”的文件,编程界面能够显示关于目标项目的至少一个代码模块的选择界面,以便根据对应的代码段进行编程。在一些应用场景中,用户为目标项目的制作者的情况下,用户可以通过选择预设目录下的定义文件,并在代码编辑区显示关于目标项目的至少一个代码模块的选择界面,以便根据对应的代码段进行编程。
在本公开实施方式中,通过在获取关于目标项目对应的至少一个代码模块之前,接收用户为目标项目创建定义文件的指令,然后响应该指令为目标项目创建定义文件并将创建的定义文件存放于预设目录,能够方便用户针对不同的项目创建对应的代码模块,以适用于不同的项目需求或不同的程序语言。
在一些实施方式中,在步骤S102之后,所述方法还包括步骤S103至步骤S105,其中:
步骤S103:基于用户对预设目录中的定义文件的选择指令,显示定义文件的内容结构。
步骤S104:接收用户对定义文件的内容结构的修改指令。
步骤S105:响应于修改指令,对定义文件的内容结构进行修改。
例如,用户通过点击预设目录中的定义文件,能够在代码编辑区域显示被选择的定义文件的内容结构,以便用户对定义文件的内容结构进行编辑更新。又例如,在代码编辑区域可显示定义文件的文件名称、包括的至少一个代码模块的名称以及各代码模块对应的代码片段,以及各定义文件或各代码模块的描述信息。
在一些实施方式中,该定义文件的内容结构可以如下:
Figure PCTCN2022104119-appb-000001
Figure PCTCN2022104119-appb-000002
该定义文件的名称为“openapi”、代码模块的名称为“face detect”、代码模块对应的代码片段为“from se_open import Face\naccess_key_id='<AccessKeyID>'#@value{type:'string'}”,因该定义文件包括一个代码模块,则定义文件的描述信息与代码模块的描述信息相同为“This is a demo api”。在一些实施方式中,定义文件包括多个代码模块的情况下,每个代码模块都可以有对应的描述信息。
如图2所示,用户还可点击控件25,该控件25的名称为“更多定义……”,用于显示更多的定义文件,或创建定义文件。其中,用户对定义文件的内容结构的修改指令可以是用户对代码编辑区域中显示的定义文件的内容结构的编辑操作,响应于该编辑操作对定义文件的内容结构进行修改,并响应于用户的保存操作保存对定义文件的内容结构的修改。
在一些应用场景中,用户为目标项目的实验者(例如,学生)时,用户没有编辑或更新关于目标项目的定义文件的权限,因此,在用户的***显示界面上不会显示预设目录,仅显示“实验文件”目录,或者在用户的***显示界面上虽然显示有预设目录,但该预设目录中的文件不可编辑,以便用户基于目标项目的代码模块进行编程。而在用户为目标项目的制作者(例如,老师)时,用户的***显示界面上会显示预设目录以及“实验文件”目录,且该预设目录中的文件可编辑,以便用户能够 对预设目录里面的定义文件进行编辑和更新,以及使用“实验文件”目录中的代码模块向学生进行编程示范等操作。
在本公开实施方式中,通过基于用户对预设目录中的定义文件的选择指令,显示定义文件的内容结构,并根据用户对定义文件的内容结构的修改指令,对定义文件的内容结构进行修改,从而方便用户随时编辑和更新这些定义文件。
在一些实施方式中,该编程方法还包括步骤S14至步骤S15,其中:
步骤S14:响应于用户对代码编辑区域中选择的目标代码片段的创建指令,基于目标代码片段创建新的代码模块。
步骤S15:将新的代码模块保存至已有或新建的定义文件中。
这里,已有的定义文件指的是包括至少一个代码模块的定义文件,新建的定义文件指的是不包括代码模块的定义文件。如图2所示,用户在代码编辑区中编辑了代码段22和代码段23,用户通过选择代码段22或代码段23,可以将其拖拽至名称为“openapi.json”的定义文件中,或通过点击鼠标右键等方式,根据提示操作,生成创建指令,将该选择的代码段加入已有的定义文件或新建的定义文件中,作为新建的代码模块的代码段或已有代码模块的代码段。例如,可将选择的代码段作为已有定义文件中已有代码模块的新增的代码段,或代替该代码模块的已有代码段,或将选择的代码段作为已有定义文件的新建代码模块的代码片段,或将代码片段作为新增定义文件的代码模块的代码片段。在一些实施方式中,将新的代码模块保存至对应的定义文件后,该定义文件的内容结构信息(例如,新的代码模块的模块标识、描述信息等内容)由用户自行设置或基于预设方式确定定义文件的内容结构信息。例如,显示用于提示用户设置定义文件的内容结构信息的指示信息,以便用户根据该指示信息输入定义文件的内容结构信息,比如,用户根据提示信息输入代 码模块的标识,以及该代码模块的描述信息或为定义文件新增描述信息。又例如,将新的代码模块保存至对应的定义文件之后,对代码模块中的代码段进行语义分析,确定代码模块的名称、代码模块的描述信息等。
在本公开实施方式中,通过定义了定义文件的文件标识、至少一个代码模块的模块标识以及各代码模块对应的代码片段,能够便于用户对代码模块以及各代码模块的代码片段等信息进行编辑和更新。另外,通过根据用户对代码编辑区域中的目标代码片段的选择指令,基于目标代码片段创建新的代码模块,使得能够快捷创建代码模块。
在一些实施方式中,上述步骤S12可以包括步骤S121,其中:
步骤S121:在选择界面的模块选择区域显示至少一个代码模块的模块标识。
在一些实施方式中,上述步骤S13可以包括步骤S131,其中:
步骤S131:响应于用户对模块选择区域中的代码模块的模块标识的选择指令,在选择界面的代码编辑区域显示选择的代码模块的代码段。
图4为本公开实施例提供的一种编程界面包括选择界面的示意图。如图4所示,该选择界面包括目标项目410、模块选择区域420、代码编辑区域430及显示输入值的对话框440,当用户选择“usercode.py”的文件之后或用户在打开目标项目之后,选择界面中显示的模块选择区域420中包括定义文件标识“common”以及“openapi”,以及定义文件标识“common”下包括的两个代码模块的模块标识“io_read”以及“oss_read”,定义文件标识“openapi”下包括的两个代码模块的模块标识“face detect”以及“object detect”。可以认为定义文件标识“common”以及两个模块标识“io_read”、“oss_read”为一组可视化代码模块,对应一个定义文件“common.json”。类似的,定义文件标识“openapi”以及两个模块标识“face detect”、“object detect”为一组可视化代码模块,对应一个定义文件 “openapi.json”。
其中,在两个代码模块的模块标识处于显示状态的情况下,可以通过点击定义文件标识,将该定义文件标识下的代码模块的模块标识隐藏。同理,在定义文件标识下的模块标识处于隐藏状态的情况下,可以点击定义文件标识,显示该定义文件标识下的模块标识。
用户通过点击其中一个代码模块的模块标识,能够在代码编辑区域显示选择的代码模块的代码段。如图4所示,当用户点击模块选择区域420中的“face detect”这个代码模块时,则在代码编辑区域430中显示该代码模块对应的代码段。
在本公开实施方式中,通过在选择界面的模块选择区域显示至少一个代码模块的模块标识,然后通过响应于用户对模块选择区域中代码模块的模块标识的选择指令,能够在选择界面的代码编辑区域显示选择的代码模块的代码段,形成抽屉式的代码可视化。
在一些实施方式中,在显示选择的代码模块的代码段之后,所述方法还包括步骤S16至步骤S17,其中:
步骤S16:响应于代码段中存在变量,显示用于提示用户输入变量的值的标识。
步骤S17:响应于接收到用户输入的变量的值,在选择的代码模块的代码段中填入变量的值。
这里,用于提示用户输入变量值的标识可以是对话框。在一些实施方式中,若代码段中存在变量,可以使用对话框的方式提示用户输入变量的值,还可以通过对该变量使用不同的颜色提示、或使用其他的指示信息,提示用户输入该变量的值。
如图4所示,当用户点击模块选择区域420中的“face detect”这个模块时,则在代码编辑区域430中显示该代码模块对应的代码段,且由于 代码段中存在变量“access_key_id”,则显示输入值的对话框440,用户可以在对话框440内输入该变量的值,用户点击确定之后,关闭对话框440,则对话框440接收到的值将显示在代码段的对应位置。在一些实施方式中,在代码段中可以利用注释#@value来指定变量,编程***获取代码段后,可根据这些注释生成对话框界面,便于学生以对话框交互方式显式的输入变量值,减少直接改动代码引起的错误。
在本公开实施方式中,通过在代码段中存在变量的情况下,显示供用户输入变量的值的对话框,并根据用户输入的变量的值,在对应的代码段中提示变量的值。另外,通过使用对话框的方式提示用户在对话框中输入变量的值,便于以对话框交互方式显式的输入变量值,减少直接改动代码引起的错误。在一些应用场景中,目标项目的实验者在编程***打开目标项目时,编程***能够自动读取关于目标项目的定义文件生成包括至少一个代码模块的选择界面。
在一些实施方式中,用户通过点击一个或多个代码模块的模块标识,在代码编辑区域进行代码段的组合,可以根据代码段的组合完成目标项目。
在一些应用场景中,目标项目为实验项目,实验设计者可以根据教学需求在编程***上制作实验,编写实验代码过程中可以随时将制定代码片段生成代码模块,并保存至定义文件中,然后通过定义文件也可以再编辑或更新这些代码片段。学生使用时,编程***可以根据实验项目中的定义文件产生***实验操作界面中的选择界面,选择界面中显示模块标识,学生可以点击模块标识在代码编辑区域显示对应的代码段并组合各代码段完成相应的实验。通过此种方式,对于学生而言可以完成较复杂的代码的填充和编写,提升学习效率和自学能力。对于老师而言,老师可以随时根据需求为各个实验项目定制对应的代码模块,以适用于 不同的实验需求以及不同的程序语言。换言之,各代码模块的程序语言可以相同也可以不同。
在一些实施方式中,编程方法的执行主体可以是编程***或编程装置,其中,编程***或编程装置可以应用于终端设备、服务器、或其它处理设备,或者是上述设备的组合。其中,终端设备可以为用户设备(User Equipment,UE)、移动设备、用户终端、终端、蜂窝电话、无绳电话、个人数字处理(Personal Digital Assistant,PDA)、手持设备、计算设备、车载设备、可穿戴设备等。在一些实施方式中,该编程方法可以通过处理器调用存储器中存储的计算机可读指令的方式来实现。
本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的撰写顺序并不意味着严格的执行顺序而对实施过程构成任何限定,各步骤的具体执行顺序应当以其功能和可能的内在逻辑确定。
本公开实施例中提供了与编程方法对应的编程装置,由于本公开实施例中的装置解决问题的原理与本公开实施例上述方法相似,因此装置的实施可以参见方法的实施。
图5为本公开实施例提供的一种编程装置的组成结构示意图,如图5所示,编程装置50包括获取部分51、第一显示部分52以及第二显示部分53。
所述获取部分51,被配置为获取关于目标项目对应的至少一个代码模块,每一代码模块分别对应有至少一个代码段;
所述第一显示部分52,被配置为显示至少一个代码模块的选择界面;
所述第二显示部分53,被配置为响应于用户通过选择界面对代码模块的选择指令,显示选择的代码模块的代码段,其中,显示的代码段可被编辑。
在一些实施方式中,所述获取部分51,还被配置为:获取关于目标 项目的定义文件集,定义文件集中的每一定义文件中包括至少一个代码模块;基于定义文件集,得到关于目标项目的至少一个代码模块。
在一些实施方式中,所述第一显示部分52,还被配置为:在选择界面的模块选择区域显示至少一个代码模块的模块标识;所述第二显示部分53,还被配置为:响应于用户对模块选择区域中的代码模块的模块标识的选择指令,在选择界面的代码编辑区域显示选择的代码模块的代码段。
在一些实施方式中,所述获取部分51,还被配置为:接收用户为目标项目创建定义文件的创建指令;响应于创建指令,创建定义文件并将用户创建的定义文件存放于预设目录。
在一些实施方式中,所述获取部分51,还被配置为:基于用户对预设目录中的定义文件的选择指令,显示定义文件的内容结构;接收用户对定义文件的内容结构的修改指令;响应于修改指令,对定义文件的内容结构进行修改。
在一些实施方式中,定义文件的内容结构包括定义文件的文件标识、至少一个代码模块的模块标识以及每一代码模块对应的代码片段;和/或,所述获取部分51,还被配置为:响应于用户对代码编辑区域中选择的目标代码片段的创建指令,基于目标代码片段创建新的代码模块;将新的代码模块保存至已有或新建的定义文件中。
在一些实施方式中,所述第二显示部分53,还被配置为:响应于代码段中存在变量,显示用于提示用户输入变量的值的标识;响应于在对话框内接收到用户输入的变量的值,在选择的代码模块的代码段中填入变量的值。
关于图像处理编程装置中的各部分的处理流程、以及各部分之间的交互流程的描述可以参照上述编程方法实施例中的相关说明。
在本公开实施例以及其他的实施例中,“部分”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是单元,还可以是模块也可以是非模块化的。
图6为本公开实施例提供的一种电子设备的结构示意图。电子设备60包括存储器61和处理器62,处理器62连接存储器61,处理器62用于执行存储器61中存储的程序指令,以实现上述任一编程方法实施例中的步骤。在一些实施场景中,电子设备60可以包括但不限于:编程设备、微型计算机、台式电脑、服务器,此外,电子设备60还可以包括笔记本电脑、平板电脑等移动设备,在此不做限定。
在一些实施方式中,处理器62用于控制其自身以及存储器61以实现上述任一编程方法实施例中的步骤。处理器62还可以称为CPU(Central Processing Unit,中央处理单元)。处理器62可以是一种集成电路芯片,具有信号的处理能力。处理器62还可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。另外,处理器62可以由集成电路芯片共同实现。
本公开实施例还提供一种计算机可读存储介质,该计算机可读存储介质上存储有程序指令,该程序指令被处理器执行时实现上述编程方法实施例中的步骤。其中,该存储介质可以是易失性或非易失的计算机可读取存储介质。
图7为本公开实施例提供的一种计算机可读存储介质的结构示意图。计算机可读存储介质70存储有程序指令71,程序指令71被处理器执行 时实现上述任一编程方法实施例中的步骤。
在一些实施例中,本公开实施例提供的***具有的功能或包含的部分可以用于执行上文方法实施例描述的方法,其具体实现可以参照上文方法实施例的描述。
本公开实施例还提供一种计算机程序产品,包括计算机指令或指令,在计算机程序或指令在电子设备上运行的情况下,使得电子设备执行上述编程方法实施例中的步骤。其中,计算机程序产品可以是任何能实现上述编程方法的产品,该计算机程序产品中对现有技术做出贡献的部分或全部方案可以以软件产品(例如软件开发包(Software Development Kit,SDK))的形式体现,该软件产品可以被存储在一个存储介质中,通过包含的计算机指令使得相关设备或处理器执行上述编程方法的部分或全部步骤。
上文对各个实施例的描述倾向于强调各个实施例之间的不同之处,其相同或相似之处可以互相参考。
在本公开所提供的几个实施例中,应该理解到,所揭露的方法和***,可以通过其它的方式实现。例如,以上所描述的***实施方式是示意性的,例如,部分或单元的划分,为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如单元或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,***或单元的间接耦合或通信连接,可以是电性、机械或其它的形式。
另外,在本公开各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。集成的单元如果以软件功能单元的形式 实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本公开各个实施方式方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
工业实用性
本公开实施例提供了一种编程方法和装置、设备、存储介质和计算机程序产品,其中,该编程方法包括:获取关于目标项目的至少一个代码模块,每一代码模块分别对应有至少一个代码段;显示至少一个代码模块的选择界面;响应于用户通过选择界面对代码模块的选择指令,显示选择的代码模块的代码段,其中,显示的代码段可被编辑。上述方案,一方面,实现了代码可视化,从而降低了用户的编程难度;另一方面,该编程方式可以适应于不同用户,从而提高了编程的普适性。

Claims (17)

  1. 一种编程方法,包括:
    获取关于目标项目的至少一个代码模块,每一所述代码模块分别对应有至少一个代码段;
    显示所述至少一个代码模块的选择界面;
    响应于用户通过所述选择界面对代码模块的选择指令,显示选择的代码模块的代码段,其中,显示的所述代码段可被编辑。
  2. 根据权利要求1所述的方法,其中,所述获取关于目标项目的至少一个代码模块,包括:
    获取关于所述目标项目的定义文件集,所述定义文件集中的每一定义文件中包括至少一个代码模块;
    基于所述定义文件集,得到关于所述目标项目的所述至少一个代码模块。
  3. 根据权利要求1或2所述的方法,其中,所述显示所述至少一个代码模块的选择界面,包括:
    在所述选择界面的模块选择区域显示所述至少一个代码模块的模块标识;
    所述响应于用户通过所述选择界面对代码模块的选择指令,显示选择的代码模块的代码段,包括:
    响应于用户对所述模块选择区域中的所述代码模块的模块标识的选择指令,在所述选择界面的代码编辑区域显示所述选择的代码模块的代码段。
  4. 根据权利要求1-3中任一项所述的方法,其中,在所述获取关于目标项目的至少一个代码模块之前,所述方法还包括:
    接收用户为所述目标项目创建定义文件的创建指令;
    响应于所述创建指令,创建所述定义文件并将用户创建的定义文件存放于预设目录。
  5. 根据权利要求4所述的方法,其中,所述响应于所述创建指令,创建所述定义文件并将用户创建的定义文件存放于预设目录之后,所述方法还包括:
    基于用户对所述预设目录中的定义文件的选择指令,显示所述定义文件的内容结构;
    接收用户对所述定义文件的内容结构的修改指令;
    响应于所述修改指令,对所述定义文件的内容结构进行修改。
  6. 根据权利要求5所述的方法,其中,所述定义文件的内容结构包括所述定义文件的文件标识、至少一个代码模块的模块标识以及每一所述代码模块对应的代码片段;
    和/或,所述方法还包括:
    响应于用户对代码编辑区域中选择的目标代码片段的创建指令,基于所述目标代码片段创建新的代码模块;
    将所述新的代码模块保存至已有或新建的定义文件中。
  7. 根据权利要求1-6任一项所述的方法,其中,在所述显示选择的代码模块的代码段之后,还包括:
    响应于所述代码段中存在变量,显示用于提示用户输入所述变量的值的标识;
    响应于接收到用户输入的所述变量的值,在所述选择的代码模块的所述代码段中填入所述变量的值。
  8. 一种编程装置,包括:
    获取部分,被配置为获取关于目标项目对应的至少一个代码模块,每一所述代码模块分别对应有至少一个代码段;
    第一显示部分,被配置为显示所述至少一个代码模块的选择界面;
    第二显示部分,被配置为响应于用户通过所述选择界面对代码模块的选择指令,显示选择的代码模块的代码段,其中,显示的所述代码段可被编辑。
  9. 根据权利要求8所述的装置,其中,所述获取部分,还被配置为:
    获取关于所述目标项目的定义文件集,所述定义文件集中的每一定义文件中包括至少一个代码模块;
    基于所述定义文件集,得到关于所述目标项目的所述至少一个代码模块。
  10. 根据权利要求8或9所述的装置,其中,
    所述第一显示部分,还被配置为:在所述选择界面的模块选择区域显示所述至少一个代码模块的模块标识;
    所述第二显示部分,还被配置为:响应于用户对所述模块选择区域中的所述代码模块的模块标识的选择指令,在所述选择界面的代码编辑区域显示选择的代码模块的代码段。
  11. 根据权利要求8-10中任一项所述的装置,其中,所述获取单元,还被配置为:
    接收用户为所述目标项目创建定义文件的创建指令;
    响应于所述创建指令,创建所述定义文件并将用户创建的定义文件存放于预设目录。
  12. 根据权利要求11所述的装置,其中,所述获取单元,还被配置为:
    基于用户对所述预设目录中的定义文件的选择指令,显示所述定义文件的内容结构;
    接收用户对所述定义文件的内容结构的修改指令;
    响应于所述修改指令,对所述定义文件的内容结构进行修改。
  13. 根据权利要求12所述的装置,其中,所述定义文件的内容结构包括所述定义文件的文件标识、至少一个代码模块的模块标识以及每一所述代码模块对应的代码片段;
    和/或,
    所述获取单元,还被配置为:响应于用户对代码编辑区域中选择的目标代码片段的创建指令,基于所述目标代码片段创建新的代码模块;将所述新的代码模块保存至已有或新建的定义文件中。
  14. 根据权利要求9-13任一项所述的装置,其中,所述第二显示单元,还被配置为:
    响应于所述代码段中存在变量,显示用于提示用户输入所述变量的值的标识;
    响应于接收到用户输入的所述变量的值,在所述选择的代码模块的所述代码段中填入所述变量的值。
  15. 一种电子设备,包括存储器以及处理器,所述处理器连接所述存储器,用于执行所述存储器中存储的程序指令,以实现权利要求1至7任一项所述的方法。
  16. 一种计算机可读存储介质,其上存储有程序指令,所述程序指令被处理器执行时实现权利要求1至7任一项所述的方法。
  17. 一种计算机程序产品,所述计算机程序产品包括计算机程序或指令,在所述计算机程序或指令在电子设备上运行的情况下,使得所述电子设备执行权利要求1至7中任意一项所述的方法。
PCT/CN2022/104119 2022-03-15 2022-07-06 编程方法和装置、设备、存储介质及计算机程序产品 WO2023173631A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210254504.0 2022-03-15
CN202210254504.0A CN114579118A (zh) 2022-03-15 2022-03-15 编程方法和***、设备、存储介质

Publications (1)

Publication Number Publication Date
WO2023173631A1 true WO2023173631A1 (zh) 2023-09-21

Family

ID=81780862

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/104119 WO2023173631A1 (zh) 2022-03-15 2022-07-06 编程方法和装置、设备、存储介质及计算机程序产品

Country Status (2)

Country Link
CN (1) CN114579118A (zh)
WO (1) WO2023173631A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118151917A (zh) * 2024-05-09 2024-06-07 青岛国创智能家电研究院有限公司 用于嵌入式产品开发的方法、装置、电子设备和存储介质

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114579118A (zh) * 2022-03-15 2022-06-03 上海商汤智能科技有限公司 编程方法和***、设备、存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130074036A1 (en) * 2011-09-16 2013-03-21 Joel R. Brandt Methods and apparatus for code segment handling
CN109783081A (zh) * 2018-12-27 2019-05-21 百富计算机技术(深圳)有限公司 一种应用程序的开发方法、装置及集成开发工具
CN110442329A (zh) * 2019-06-26 2019-11-12 平安科技(深圳)有限公司 代码段的生成方法、装置、存储介质及计算机设备
CN112306480A (zh) * 2020-10-16 2021-02-02 深圳市大富网络技术有限公司 一种可视化编程控制方法、***、装置及计算机存储介质
CN112306481A (zh) * 2020-10-16 2021-02-02 深圳市大富网络技术有限公司 图形化编程场景的代码展示方法、***、装置及存储介质
CN114579118A (zh) * 2022-03-15 2022-06-03 上海商汤智能科技有限公司 编程方法和***、设备、存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130074036A1 (en) * 2011-09-16 2013-03-21 Joel R. Brandt Methods and apparatus for code segment handling
CN109783081A (zh) * 2018-12-27 2019-05-21 百富计算机技术(深圳)有限公司 一种应用程序的开发方法、装置及集成开发工具
CN110442329A (zh) * 2019-06-26 2019-11-12 平安科技(深圳)有限公司 代码段的生成方法、装置、存储介质及计算机设备
CN112306480A (zh) * 2020-10-16 2021-02-02 深圳市大富网络技术有限公司 一种可视化编程控制方法、***、装置及计算机存储介质
CN112306481A (zh) * 2020-10-16 2021-02-02 深圳市大富网络技术有限公司 图形化编程场景的代码展示方法、***、装置及存储介质
CN114579118A (zh) * 2022-03-15 2022-06-03 上海商汤智能科技有限公司 编程方法和***、设备、存储介质

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118151917A (zh) * 2024-05-09 2024-06-07 青岛国创智能家电研究院有限公司 用于嵌入式产品开发的方法、装置、电子设备和存储介质

Also Published As

Publication number Publication date
CN114579118A (zh) 2022-06-03

Similar Documents

Publication Publication Date Title
Fox et al. An R companion to applied regression
US20230385033A1 (en) Storing logical units of program code generated using a dynamic programming notebook user interface
WO2023173631A1 (zh) 编程方法和装置、设备、存储介质及计算机程序产品
EP3433732B1 (en) Converting visual diagrams into code
WO2021017735A1 (zh) 一种智能合约的形式化验证方法、电子装置及存储介质
CN116860949B (zh) 问答处理方法、装置、***、计算设备及计算机存储介质
Toms ArcPy and ArcGIS–Geospatial Analysis with Python
CN111324609A (zh) 知识图谱构建方法、装置、电子设备及存储介质
Goguen et al. 7 Information visualisation and semiotic morphisms
Rossant Learning IPython for interactive computing and data visualization
Patil et al. Enhanced UI Automator Viewer with improved Android accessibility evaluation features
Nagar Introduction to Python for Engineers and Scientists: Open Source Solutions for Numerical Computation
Rahmadi et al. Visual recognition of graphical user interface components using deep learning technique
CN111602129A (zh) 针对注释和墨迹的智能搜索
CN109977197B (zh) 一种电子习题的处理方法、装置、设备和存储介质
JP2024528385A (ja) 教室活動コースウェア作成方法、装置、記憶媒体および電子機器
CN113900956A (zh) 测试用例的生成方法、装置、计算机设备及存储介质
US8887136B2 (en) Context-based evaluation of equations
Elouali et al. A model-based approach for engineering multimodal mobile interactions
CN114063868A (zh) 一种ai拖拽建模***、方法、计算机设备及应用
US10649739B2 (en) Facilitating application development
JP2008217443A (ja) ビジネスプロセスシミュレータ及びビジネスプロセスシミュレーションプログラム
Milovanovic et al. Python Data Visualization Cookbook
US12051205B1 (en) Systems and methods for interacting with a large language model
Bennett et al. Swift 2 for Absolute Beginners

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22931654

Country of ref document: EP

Kind code of ref document: A1