A method, apparatus, device, storage medium, and program product for program detection
By detecting the input component values of building blocks in real time in the programming building block environment, the problem of inefficiency of traditional code detection solutions is solved, and real-time exception detection in the code program generation process is realized.
Patent Information
- Application Number
- CN202310956685.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-31
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2043-07-31
AI Technical Summary
Traditional code detection schemes require waiting until the code program is run before detecting whether there are abnormal problems in the code, resulting in inefficient detection.
By obtaining operation events in the programming building block environment, displaying the input components of each building block, and traversing the input values of these input components, detecting whether there are exceptions in the code program in real time.
It realizes real-time detection of code exceptions during the code program generation process, improves detection efficiency and avoids the delay in waiting for the code to run before detection.
Smart Images

Figure CN118012735B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular, to a method, device, equipment, storage medium and program product for program detection. Background Art
[0002] Programming blocks are a visual programming language that uses blocks to represent each code block in a code program. The blocks are dragged and dropped into the code editing area to construct a complete code program.
[0003] In a programming block environment, a target object uses programming blocks to write its own required code program. If the code is abnormal, it will affect the correct result of the code program operation. In traditional code detection schemes, for whether code exceptions occur in a code program, etc., it is necessary to wait for the target object to write a complete code program and click the run control for running the code program, and then it will be detected whether there are abnormal problems in the code program during the program operation. That is to say, in the traditional method, the code program is detected only after the code is written and run. However, this is not conducive to detecting in a timely manner whether there are abnormal situations in the code program, resulting in the target object needing to spend more costs to detect the abnormal problems of the code program, greatly reducing the detection efficiency. Summary of the Invention
[0004] The embodiments of the present application provide a method, device, equipment, storage medium and program product for program detection, which can perform abnormal detection on a code program in real time and in a timely manner, and improve the detection efficiency.
[0005] In a first aspect, the embodiments of the present application provide a method for program detection. The method includes: obtaining an operation event, where the operation event is an event when operating on at least two blocks in a block editing area; in response to a trigger operation for the operation event, displaying one or more input components of each block, where each input component is a component for receiving an assignment operation on the functional attribute of the block; traversing and detecting the input values of each corresponding input component in each block to obtain a detection result corresponding to the block; determining a code detection result based on the detection result of each block, where the code detection result is used to indicate whether there is a code exception in the code program generated in the code editing area, the code program is generated by at least two code blocks and the code logic relationship between the at least two code blocks, each block corresponds to one code block of the at least two code blocks, and the connection relationship between the at least two blocks corresponds to the code logic relationship between the at least two code blocks.
[0006] Second aspect, an embodiment of the present application provides a program detection device. The program detection device includes an acquisition unit, a display unit, and a processing unit. Among them, the acquisition unit is configured to acquire an operation event, where the operation event is an event when operating at least two building blocks in a building block editing area. The display unit is configured to display one or more input components of each building block in response to a trigger operation for the operation event, and each input component is a component that receives a selection operation for the functional attribute of the building block. The processing unit is configured to traverse and detect the input values of each corresponding input component in each building block to obtain a detection result corresponding to the building block. The processing unit is configured to determine a code detection result based on the detection results of each building block, and the code detection result is used to indicate whether a code exception occurs in a code program generated in a code editing area; wherein, the code program is generated by at least two code blocks and the code logic relationship between the at least two code blocks, each building block corresponds to one code block among the at least two code blocks, and the connection relationship between the at least two building blocks corresponds to the code logic relationship between the at least two code blocks.
[0007] In some alternative embodiments, the processing unit is configured to: for a first building block, determine the component type corresponding to the input component based on the configuration information of each input component in the first building block, where the first building block is any one of the at least two building blocks; determine an exception detection rule corresponding to the component type of the input component based on the component type of each input component and a preset mapping relationship, where the preset mapping relationship is used to indicate the relationship between the component type and the exception detection rule; traverse each input component, and when the input value of the input component matches the corresponding exception detection rule, determine that the input value of the input component is an abnormal input value; determine that the detection result of the first building block is an abnormal result based on the abnormal input value of the input component.
[0008] In some other alternative embodiments, the component type includes a functional module input box type; the processing unit is configured to: when the input value of a first input component matches a first detection value, determine that the input value of the first input component is an abnormal input value; where the first input component is any one of the multiple input components in the first building block, and the first detection value is used to indicate a detection index for indicating invalid input in the exception detection rule corresponding to the functional module input box type.
[0009] In some other alternative embodiments, the component type includes a digital input box type; the processing unit is configured to: when the input value of the second input component matches the second detection value, determine that the input value of the second input component is an abnormal input value; wherein, the second input component is any one of the multiple target input components in the first building block, and the second detection value is used to indicate a detection index for indicating non-numeric input in the abnormal detection rule corresponding to the digital input box type.
[0010] In some other alternative embodiments, the component type includes a text input box type; the processing unit is configured to: when the input value of the third input component matches the third detection value, determine that the input value of the third input component is an abnormal input value; wherein, the third input component is any one of the multiple target input components in the first building block, and the third detection value is used to indicate a detection index for indicating non-text input in the abnormal detection rule corresponding to the text input box type.
[0011] In some other alternative embodiments, the component type includes a color selection box type; the processing unit is configured to: when the input value of the fourth input component matches the fourth detection value, determine that the input value of the fourth input component is an abnormal input value; wherein, the fourth input component is any one of the multiple target input components in the first building block, and the fourth detection value is used to indicate a detection index for indicating no color value input in the abnormal detection rule corresponding to the color selection box type.
[0012] In some other alternative embodiments, the processing unit is further configured to: after determining that the detection result of the first building block is an abnormal result based on the abnormal input value of the input component, perform an abnormal prompt process on the first building block.
[0013] In some other alternative embodiments, the processing unit is configured to: adjust the background color value of the first building block from a first color value to a second color value to perform an abnormal prompt process on the first building block, and the background color corresponding to the first color value is different from the background color corresponding to the second color value.
[0014] In some other alternative embodiments, the processing unit is configured to: highlight or flash the first building block to perform an abnormal prompt process on the first building block.
[0015] In some other alternative embodiments, the processing unit is configured to: adjust the border color value of the input component corresponding to the abnormal input value in the first building block from a first border color value to a second border color value to perform an abnormal prompt process on the first building block, and the first border color value is less than the second border color value.
[0016] In some other alternative embodiments, the processing unit is configured to: highlight or flash the input component corresponding to the abnormal input value in the first building block, so as to perform abnormal prompt processing on the first building block.
[0017] In some other alternative embodiments, the processing unit is further configured to: after determining that the detection result of the first building block is an abnormal result based on the abnormal input value of the input component, in response to a trigger operation on the first building block, display the abnormal detail information of the first building block.
[0018] In some other alternative embodiments, the processing unit is further configured to: after determining that the detection result of the first building block is an abnormal result based on the abnormal input value of the input component, in response to a trigger operation on the operation control of the code program, display a prompt message, where the prompt message is used to indicate the abnormal detail information of the first building block.
[0019] In some other alternative embodiments, the obtaining unit is further configured to: before the obtaining operation event, obtain building block configuration information and an extension identifier, where the building block configuration information includes an extension field, and the extension identifier is used to identify at least one functional module. The processing unit is configured to map the extension identifier to the extension field to generate a building block.
[0020] In some other alternative embodiments, the processing unit is configured to determine that the detection result of the code program is an abnormal detection result when the detection results of one or more of the building blocks are abnormal results.
[0021] A third aspect of the embodiments of the present application provides a program detection device, including: a memory, an input / output (I / O) interface, and a memory. The memory is used to store program instructions. The processor is used to execute the program instructions in the memory to perform the program detection method corresponding to the embodiments of the first aspect above.
[0022] A fourth aspect of the embodiments of the present application provides a computer-readable storage medium, in which instructions are stored, and when they run on a computer, cause the computer to execute the method corresponding to the embodiments of the first aspect above.
[0023] A fifth aspect of the embodiments of the present application provides a computer program product including instructions, and when it runs on a computer or a processor, causes the computer or the processor to execute the method corresponding to the embodiments of the first aspect above.
[0024] From the above technical solutions, it can be seen that the embodiments of the present application have the following advantages:
[0025] In the embodiments of the present application, the generation of the code program is implemented by at least two code blocks and the code logic relationship between at least two code blocks. Moreover, each building block can correspond to one of the at least two code blocks, and the connection relationship between at least two building blocks corresponds to the code logic relationship between at least two code blocks. Therefore, when obtaining the event of the target object operating on at least two building blocks in the building block editing area, that is, after obtaining the operation event, by responding to the trigger operation for the operation event, one or more input components of each building block can be displayed. For each input component, it is understood as the component when receiving the assignment operation of the target object on the functional attribute of the building block. By traversing and detecting the input values of each input component corresponding to each building block, the detection result of the corresponding building block can be detected. In this way, after obtaining the detection results of each building block, the code detection result is determined based on the detection results of each building block. Through this code detection result, it can be indicated whether there is a code exception in the code program generated in the code editing area. Through the above method, building blocks are used to represent code blocks in the coding building block scenario. Furthermore, during the generation of the code program, the detection result of the building block is determined by detecting the input values of each input component in the building block, so as to determine the code detection result. That is to say, the embodiments of the present application do not need to detect whether the code program has an exception only after the code program runs. Moreover, during the generation of the code program, whether there is a code exception in the corresponding generated code program is determined by whether the input values of the input components in the building block are abnormal, and the code program can be detected for exceptions in real time and in a timely manner, improving the detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0027] Figure 1 A schematic diagram showing the writing of a code program based on building blocks;
[0028] Figure 2A A schematic diagram showing the "actuator" function model provided by the embodiments of the present application;
[0029] Figure 2B A schematic diagram showing the building block corresponding to the "actuator" function model provided by the embodiments of the present application;
[0030] Figure 3A A schematic diagram showing the "power device" function model provided by the embodiments of the present application;
[0031] Figure 3B Shows a schematic diagram of the building blocks corresponding to the "power device" function model provided by the embodiments of the present application;
[0032] Figure 4A Shows a schematic diagram of selecting a function module during the process of writing a code program;
[0033] Figure 4B Shows a schematic diagram of selecting the building blocks corresponding to the function module during the process of writing a code program;
[0034] Figure 5A Shows a schematic diagram of selecting building blocks in a programming building block environment;
[0035] Figure 5B Shows a schematic diagram of program anomaly detection when no function module is selected in the traditional detection scheme;
[0036] Figure 5C Shows a schematic diagram of anomaly prompt in the traditional detection scheme;
[0037] Figure 6 Shows a flowchart of a method for program detection provided by the embodiments of the present application;
[0038] Figure 7 Shows a schematic diagram of the building block configuration information provided by the embodiments of the present application;
[0039] Figure 8 Shows an extended flowchart provided by the embodiments of the present application;
[0040] Figure 9 Shows a schematic diagram of the extended building block configuration information provided by the embodiments of the present application;
[0041] Figure 10A Shows a schematic diagram of the building blocks showing anomalies in the existing scheme;
[0042] Figure 10B Shows a schematic diagram of the building blocks showing anomalies in the embodiments of the present application;
[0043] Figure 11 Shows a schematic diagram of the input components showing anomalies in the embodiments of the present application;
[0044] Figure 12 Shows a schematic diagram of the detailed anomaly information display in the embodiments of the present application;
[0045] Figure 13 Shows a schematic diagram of the prompt message provided by the embodiments of the present application;
[0046] Figure 14The figure shows a schematic structural diagram of the functional modules of the program detection device provided by the embodiments of the present application;
[0047] Figure 15 The figure shows a schematic hardware structure diagram of the program detection device provided by the embodiments of the present application. Detailed implementation manners
[0048] The embodiments of the present application provide a method, device, equipment, storage medium and program product for program detection, which can perform anomaly detection on code programs in real time and in a timely manner, and improve the detection efficiency.
[0049] It can be understood that in the specific implementation manners of the present application, data related to user information, etc. is involved. When the above embodiments of the present application are applied to specific products or technologies, user permission or consent needs to be obtained, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of relevant countries and regions.
[0050] Next, the technical solutions in the embodiments of the present application will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0051] The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of the present application are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application described here can be implemented in an order different from those illustrated or described here. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily limit to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these process, method, product or device.
[0052] Code is the basis of computer programs and the specific implementation of computer languages. It is a language used by computer programmers to write computer programs and a tool used by computer programmers to describe computer programs. The role and significance of code are very important. It can help programmers better understand the running process of computer programs, improve the efficiency and reliability of programs, and at the same time help programmers better manage and maintain computer programs. In a code program, there are usually at least two code blocks, and each code block is used to represent one or a section of code instructions.
[0053] With the continuous development of science and technology, more and more target objects are gradually using coding building blocks to write code programs. The described coding building blocks are a visual programming language that can use blocks to represent each code block in a code program. The target object constructs a complete code program by dragging and dropping the required blocks into the code editing area and building the connection relationships between each block.
[0054] Figure 1 A schematic diagram of writing a code program based on blocks is shown.
[0055] As Figure 1 shown, the target object can write a code program through a virtual hardware device deployed with an application or software. In the virtual hardware device, there are at least a model building layer and a code editing layer. Among them, in the model building layer, there are different types of function modules, such as "infrastructure" function module, "actuator" function module, "sensor" function module, "power device" function module, etc., which are not specifically limited in the embodiments of the present application. The target object can build the required block model by dragging and dropping the function modules it needs. For example, Figure 1 the shown block model is a "cart" model.
[0056] Exemplarily, the virtual hardware device can be deployed in hardware devices such as terminal devices, servers, etc. In this way, the construction of the corresponding block model can also be achieved by the hardware device calling the virtual hardware device, which is not specifically limited in the embodiments of the present application. In addition, in practical applications, it can also include but is not limited to "image intelligence" function module, "image capture" function module, "speech recognition" function module, "intelligent chat" function module, etc., which are not specifically limited and described in the embodiments of the present application.
[0057] For Figure 1 the different types of function modules shown, there are corresponding blocks to control them.
[0058] For example, for Figure 1 the "actuator" function module shown, it can be specifically understood with reference to the schematic diagram of the "actuator" function module shown in Figure 2A . As Figure 2A shown, in this "actuator" function module, it includes but is not limited to a small liquid crystal display (LCD), a light emitting diode (LED) colored light module, a medium-sized LCD display, etc., which are not specifically limited and described in the embodiments of the present application.
[0059] In addition, for Figure 2AThe shown "actuator" function module, and the corresponding building blocks can be referred to Figure 2B the schematic diagram shown for understanding. As Figure 2B shown, for small and medium-sized LCD monitors, the corresponding building blocks can include but are not limited to "LCD monitor [?]: Set the background color to [black]", "LCD monitor [?]: Clear the screen", "LCD monitor [?]: Set the font size to [small] and the color to [black]". Exemplarily, in practical applications, the LCD monitor may further include but is not limited to building blocks such as "LCD monitor [?]: Set the text rotation direction to [0° (default)]", "LCD monitor [?]: Print [“”]", "LCD monitor [?]: Print [“”] and line feed", etc., which are not specifically limited in the embodiments of the present application. Additionally, for the LED color light module, the corresponding building blocks can include but are not limited to "LED color light module [?]: Display [○]", "LED color light module [?]?: Display [○] for [1] second", "LED color light module [?]: Display R
[255] , G
[255] , B[0]", "LED color light module [?]: Display R
[255] , G
[255] , B[0] for [1] second", "LED color light module [?]: Increase the brightness by
[10] %", "LED color light module [?]: Set the brightness to
[30] %", "The brightness of the LED color light module [?]", etc., which are not specifically limited in the embodiments of the present application.
[0060] Similarly, for Figure 1 the "power device" function module shown in Figure 3A it can be specifically understood with reference to the schematic diagram of the "power device" function module shown in Figure 3A As shown, in this "power device" function module, it includes but is not limited to an encoded motor, an R45 power wheel, etc., and no specific limitation is given in the embodiments of the present application.
[0061] In addition, for Figure 3A the "power device" function module shown in Figure 3B it can be understood with reference to the schematic diagram shown in Figure 3B As shown, for the encoded motor, the corresponding building blocks can include but are not limited to "encoded motor [?]: Rotate forward at
[60] RMP", etc., which are not specifically limited in the embodiments of the present application. Additionally, for the R45 power wheel, the corresponding building blocks can include but are not limited to "R45 power wheel [?]: Rotate with
[30] power", etc., which are not specifically limited in the embodiments of the present application.
[0062] It should be noted that the above only takes the "actuator" function module and the "power device" function module as examples to introduce the corresponding building blocks. In practical applications, different function modules and corresponding building blocks can also be set according to the needs of the target object for writing code programs. Specifically, it is not limited in the embodiments of the present application.
[0063] During the process of writing a code program, the target object may encounter situations where it is necessary to select appropriate function modules. These candidate function modules are usually presented in the form of a drop-down box in the input component of the building block. The described input component can be understood as a component used to receive the assignment operation of the target object to the functional attributes of the building block. For example, taking the building block " Figure 3B shown above, "R45 power wheel [?]: rotate with
[30] power" as an example, its corresponding input components include two, namely [?] and
[30] . The target object can perform assignment processing in these two input components based on its own needs for writing code programs. For example, it can also be assigned as "R45 power wheel [R45 power wheel 1]: rotate with
[60] power", etc. Specifically, it is not limited in the embodiments of the present application.
[0064] In order to be able to select the correct function module in the input component, the target object needs to first use the corresponding function module in the model building layer. When the target object creates a function module in the model building layer, the name of the corresponding function module is selected during the code writing process, and then the input of the building block corresponding to the selected function module can be correctly configured.
[0065] For example, Figure 4A shows a schematic diagram of selecting a function module during the process of writing a code program. As Figure 4A shown, the target object selects the "R45 power wheel" function module in the model building layer to build a "car" model. Correspondingly, Figure 4B shows a schematic diagram of selecting the building block corresponding to the function module during the process of writing a code program. It can be seen from Figure 4B that based on the selection of the "R45 power wheel" function module, the target object can select the corresponding "R45 power wheel [?]: rotate with
[30] power" building block in the code editing layer. In addition, the names of the 4 power wheels that the target object has already used in Figure 4A will appear in the input component [?] of the "R45 power wheel" building block, such as R45 power wheel 1, R45 power wheel 2, R45 power wheel 3, and R45 power wheel 4, etc. Specifically, it is not limited in the embodiments of the present application.
[0066] In the case of writing a code program based on the aforementioned building blocks, if there are exceptions or other situations in the code program, it will seriously affect the correct operation of the code program. Therefore, to ensure the accurate operation of the code program, it is necessary to detect the code program.
[0067] Exemplarily, Figure 5A shows a schematic diagram of selecting building blocks in a programming building block environment. As Figure 5A shown, the target object can adaptively build a building block model using general modules and functional modules in the model building layer, such as the aforementioned Figure 4A "car" model mentioned. The code program to be generated is represented by the building block model. It should be noted that the described general modules can be understood as modules without functional attributes, such as basic cube and hemisphere modules, and only use general modules to build the structure. The described functional modules can be understood as the functions and roles that the code blocks need to implement, such as the aforementioned "power device" functional module, which can provide driving force, etc., and are not specifically limited in the embodiments of the present application.
[0068] In the built building block model, each functional module has a corresponding building block. The target object controls different functional modules through the building blocks. As Figure 5A shown, for input components of the type of functional module input box in the building block, their default values are all "[?]" option. At this time, it is necessary for the target object to click on the functional module input box and then select the functional module it needs to control. For example, for the functional module "R45 power wheel", there are two options, "R45 power wheel 3" and "R45 power wheel 4", corresponding to it. Suppose the target object clicks and selects "R45 power wheel 3", then the corresponding building block is determined, that is, "R45 power wheel [R45 power wheel 3]: rotate with
[30] power". Select other functional modules in a similar way to select the corresponding building blocks. Further, after selecting the required building blocks, the target object drags and drops the required building blocks into the code editing area and constructs the connection relationship between each building block, thereby constructing a complete code program.
[0069] However, it can be seen from Figure 5A that in the case where the component type of the input component of the building block is a functional module input box type, the default option of the functional module input box is "[?]". When the target object does not select any functional module in the functional module input box, the building block will only display "?", and there will be no other prompts about the functional module. This easily leads to the input value of the input component in the building block not being clearly defined, and further leads to the final generated code program being unable to execute correctly.
[0070] In traditional code detection schemes, based onFigure 5A After the building method of the shown building blocks generates the corresponding code program, only when the target object clicks the running control of the code program to make the code program run, will it be judged whether there is an abnormal situation in the code program. For example, Figure 5B It shows a schematic diagram of code program anomaly detection when the function module is not selected in the traditional detection scheme. As Figure 5B shown, when the target object does not select Figure 5A the two function modules of "R45 power wheel 3" and "R45 power wheel 4" shown, when the code program is written and run, when it executes to the building block of "R45 power wheel [?]: rotate with
[30] power", it will be judged that there is a "?" sign in the code program, that is, it is judged that there is an abnormal situation in the code program. Further, a prompt message is popped up to prompt that there is an abnormal situation in the code program. Exemplarily, Figure 5C It shows a schematic diagram of anomaly prompt in the traditional detection scheme. As Figure 5C shown, for the aforementioned Figure 5B shown anomaly detection situation, it is known from the prompt message that there is an unspecified function module in the code program.
[0071] That is to say, in the traditional detection scheme, whether there are abnormal situations in the code program can be completely detected only after the complete code program is generated based on the building blocks and the code program is run. However, this is not conducive to timely detecting whether there are abnormal situations in the code program, resulting in the target object needing to spend more costs to detect the abnormal problems of the code program, greatly reducing the detection efficiency.
[0072] Therefore, in order to solve the above-mentioned technical problems, the embodiments of the present application provide a method for program detection. This method for program detection can be applied to application scenarios such as code writing, and is not specifically limited in the embodiments of the present application.
[0073] In addition, the method for program detection provided by the embodiments of the present application does not depend on a specific hardware environment during its implementation process and can be applied to various program detection devices for operation, including but not limited to terminal devices, servers, question-and-answer robots, etc. The described terminal devices may include but are not limited to smartphones, desktop computers, laptop computers, tablet computers, smart speakers, vehicle-mounted devices, smart watches, wearable smart devices, intelligent voice interaction devices, smart home appliances, aircraft, etc. The server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery network (CDN), and big data and artificial intelligence platforms. The present application does not make specific limitations. In addition, the mentioned terminal devices and servers may be directly or indirectly connected through wired communication or wireless communication, etc., and the present application does not make specific limitations.
[0074] The following introduces a method for program detection provided by the embodiments of the present application with reference to the accompanying drawings. Figure 6 A flowchart of a method for program detection provided by the embodiments of the present application is shown. As Figure 6 shown, the method for program detection may include the following steps:
[0075] 601. Obtain an operation event, where the operation event is an event when a target object operates on at least two building blocks in a building block editing area.
[0076] In this example, the described building block editing area can be understood as the editing area in the aforementioned model building layer. In the embodiments of the present application, if a target object wants to write a required code program, in a coding building block environment, the building blocks in the model building layer can be added to the editing area by means of moving or dragging, etc. Further, the target object freely combines the required building blocks according to its own coding requirements through a program detection device, so as to form a corresponding building block model, and further generate a corresponding code program through the built building block model. That is to say, the building blocks are used as the construction units of the programming language, and then the required building blocks are added to the building block editing area, and the code program is written by connecting the building blocks.
[0077] For example, during the process of writing a code program, the program detection device can be implemented through the open-source visual programming tool Blockly. In practical applications, the process of writing a code program can also be implemented based on other programming tools, and specific limitations are not made in the embodiments of the present application.
[0078] In addition, before the target object drags and drops the building block, the building block configuration information corresponding to the building block can also be configured by defining the attributes and behaviors of the building block. The described building block configuration information may include the type identifier of the building block, input slots, output slots, text labels, appearance styles, etc., which are not limited in the specific embodiments of the present application. The described type identifier of the building block can be used to identify the building block. Different building blocks can be identified and distinguished using the type identifier. The described input slots can include one or more, and each input slot is used to receive the output value or parameter of other building blocks. Through the input slots, the parameter name, type, default value, etc. can be defined. The described output slots can include one or more. Among them, each output slot is used to output the calculation result or pass the output value to other building blocks. Through the output slots, the type and name of the return value, etc. can be defined. The described text label can be used to describe the functional attributes of the building block or provide the field value input by the target object. The mentioned appearance style can be used to define the color, shape, icon, etc. of the building block to enhance the visualization effect and user experience.
[0079] As an exemplary description, Figure 7 shows a schematic diagram of the building block configuration information provided by the embodiments of the present application. As Figure 7 shown, taking the functional module "R45 power wheel" as an example, in the building block configuration information of "R45 power wheel", the corresponding input values are configured by defining the input slots "functional module input box [?]" and "numeric input box []". For example, [?] is configured for the functional module input box and the input value 30 is configured for the numeric input box. In addition, the output slots are defined by setting "previousStatement: null" and "nextStatement: null". Similarly, the appearance style of the building block "R45 power wheel" is defined by setting "`#a568fθ`". Thus, the building block configuration information of the building block "R45 power wheel" is configured.
[0080] It should be noted that the above Figure 7 is only described by taking "R45 power wheel" as an example. In practical applications, other building block configuration information can also be understood with reference to the building block configuration information of "R45 power wheel", which will not be elaborated here.
[0081] Developers will provide target objects with different types of building blocks, and each type of building block has its corresponding building block configuration information. Through the building block configuration information, the functional attributes and the like implemented by the corresponding building block can be understood. For example, the attributes of the building block may include, but are not limited to, the functional attributes of the building block, etc., and no specific limitation is made in this application. If developers configure the functions of anomaly detection and anomaly prompt for each building block individually, it will cause a great increase in development costs and labor costs, and it is impossible to quickly perform anomaly detection and timely prompt anomalies.
[0082] Therefore, in order to support uniformly providing general anomaly detection and prompt functions for all building blocks, the embodiments of this application can implement a custom extension mechanism. Custom extension is a method for extending and customizing the functions of building blocks. This method allows developers to add new functional features or behaviors to building blocks with as little modification to existing building blocks as possible. Simply put, custom extension is like a plugin, and developers can attach the newly added functional module to the building block configuration information of the existing building block to provide additional functions for the building block. Custom extension can be used to implement various functions of building blocks, such as adding event detectors, modifying the style of building blocks, implementing custom logic, etc., and no specific limitation is made in the embodiments of this application. In other words, during the process of generating the corresponding building block based on the building block configuration information, an extension identifier can also be obtained. The described extension identifier can represent at least one functional module to be extended. Further, map the extension identifier to the extension field reserved in the building block configuration information to generate the building block in this way. In this way, the generated building block has the functions implemented by the functional module to be extended.
[0083] As a schematic description, Figure 8 Fig. shows the schematic diagram of the extension process provided by the embodiments of this application. As Figure 8 shown, the setting of the functional module to be extended can be realized through an extension function (input Checker). Further, after configuring the functional module, bind and register the functional module with the extension identifier to provide it for the building block to use. The described extension identifier can be understood as a reference identifier (identity, ID), etc., and can be used to identify and indicate a functional module. In this way, map the extension identifier to the extensions field in the building block configuration information to generate the corresponding building block. That is to say, construct a mapping relationship between the functional module and the extension identifier, and then map the extension identifier to the extension field in the building block configuration information to generate the building block, such as generating a building block of "LCD monitor [?]: Set the background color to [black]".
[0084] As a schematic description, for Figure 8The function module settings are implemented through the extended function (inputchecker), and the following code can be referred to for implementation. That is:
[0085]
[0086] As can be seen from the above code, by defining an extended function to access and modify the attributes and behaviors of building blocks, the configuration of the function module is achieved, such as setting the myExtension function module, etc.
[0087] In addition, as a schematic description, for Figure 8 the process of mapping the extension identifier to the building block configuration information in Figure 9 Figure shows a schematic diagram of the extended building block configuration information provided by an embodiment of the present application. As Figure 9 shown, in the building block configuration information of the "R45 power wheel" building block, the extension identifier (i.e., MyExtension) corresponding to the myExtension function module extended in the above code is mapped to the extension field.
[0088] Through the above Figure 8 shown extension method, extension identifiers can be added to the building block configuration information of all building blocks, so that all building blocks can have the functions implemented by the function module represented by the extension identifier.
[0089] Based on this, after generating each building block based on the above method, during the process of generating the code program by the target object, the target object can perform operations such as clicking or dragging at least two building blocks in the building block editing area, so that the program detection device can obtain the operation event. The operation event can be understood as the event when the target object operates on at least two building blocks in the building block editing area. That is to say, through the operation event, it can be clearly known which building blocks the target object triggers the operation on, that is, the required building blocks are selected.
[0090] 602. In response to the trigger operation for the operation event, display one or more input components of each building block, where each input component is a component for receiving the assignment operation of the target object to the functional attribute of the building block.
[0091] In this example, after the target object performs operations such as clicking or dragging at least two building blocks in the building block editing area, the program detection device can respond to the trigger operation for the operation event, and then determine and display one or more input components of each building block operated by the target object.
[0092] For each input component, it can be understood as a component used to receive the assignment operation of the target object to the functional attributes of the corresponding building block. In some examples, the input component can also be referred to as an input slot, and specific understanding can be made with reference to the content shown in the foregoing Figure 7 and will not be elaborated here.
[0093] For different types of input components, the values of the functional attributes they receive may be different. For example, for an input component of the functional module input box type, its assignment should be the name of the functional module used to represent the functional role, such as functional modules like "R45 power wheel 1". For an input component of the digital input box type, its assignment should be a number. Similarly, for an input component of the text input box type, its assignment should be text. For an input component of the color selection box type, its assignment should be a value that satisfies the RGB color gamut.
[0094] It should be noted that in actual applications, the types of input components can also include other types of components. Specifically, in this embodiment of the present application, only the functional module input box type, digital input box type, text input box type, and color selection box type are taken as examples for illustration.
[0095] 603. Traverse and detect the input values of each corresponding input component in each building block to obtain the detection result of the corresponding building block.
[0096] In this example, after the program detection device displays one or more input components of each building block, the target object can assign values to the input components in each building block according to the needs of its own code-writing program. For example, the program detection device can use application programming interfaces (APIs) in Blockly, such as block.inputlist and other interfaces, to obtain the input values of one or more input components in each building block.
[0097] For example, taking the building block "R45 power wheel: rotate with [] power" as an example, if the target object hopes that the "R45 power wheel" can rotate with 30 power. At this time, the target object types the value 30 in the input component []. In this way, the program detection device can obtain that the input value of the corresponding input component is 30.
[0098] After the program detection device obtains the input values of each corresponding input component in each building block, it can traverse and detect each building block. Further, the program detection device traverses and detects the input values of each corresponding input component in each building block, and determines the detection result of the corresponding building block by judging whether the input value conforms to the exception detection rule corresponding to the component type of the corresponding input component.
[0099] Exemplarily, the judgment process for the detection results of each building block is basically similar. Therefore, in the embodiments of the present application, only any one building block (i.e., the first building block) among at least two building blocks is taken as an example for detailed introduction. Specifically, it can be understood with reference to the following method, that is:
[0100] First, for the first building block, based on the configuration information of each input component in the first building block, determine the component type of the corresponding input component. It should be noted that the component types of the described input components include but are not limited to function module input box type, digital input box type, text input box type, and color selection box type, and are not specifically limited in the embodiments of the present application.
[0101] Since the input values of input components of different component types are different, the configured anomaly detection rules are also different.
[0102] For example, for an input component of the function module input box type, if its input value is "?", it means that the input value is an invalid input. At this time, the configured anomaly detection rule for this input component of the function module input box type can be "?", that is, an invalid input value.
[0103] For an input component of the digital input box type, its input value should satisfy a numerical value of the digital type. If its input value is of a non-digital type, such as a null value, letter, text, or an input exceeding the set range, etc., it means that the input value is an invalid input. At this time, the configured anomaly detection rule for this input component of the digital input box type is a non-digital type input.
[0104] For an input component of the text input box type, its input value should satisfy a numerical value of the text type. If its input value is of a non-text type, such as a null value, number, or an input exceeding the set range, etc., it means that the input value is an invalid input. At this time, the configured anomaly detection rule for this input component of the text input box type is a non-text type input.
[0105] For an input component of the color selection box type, its input value should satisfy a numerical value in the RGB color gamut. If its input value is a non-RGB color gamut numerical value, such as a null value, text, string, etc., it means that the input value is an invalid input. At this time, the configured anomaly detection rule for this input component of the color selection box type is a non-RGB color gamut numerical value input.
[0106] Therefore, after determining the component type of each input component, based on the component type of each input component and the preset mapping relationship, determine the anomaly detection rule corresponding to the component type of the corresponding input component. The described preset mapping relationship is used to indicate the relationship between the component type and the anomaly detection rule. Further, traverse each input component, and when the input value of the input component matches the corresponding anomaly detection rule, determine that the input value of the corresponding input component is an abnormal input value.
[0107] As a schematic description, in the case where the component type includes a function module input box type, the program detection device matches the input value of the first input component with the first detection value. The described first input component is any one of the multiple input components in the first building block. Additionally, the first detection value can be used to indicate the detection index for indicating invalid input in the anomaly detection rule corresponding to the function module input box type. For example, the first detection value can be the "?" symbol mentioned above. Further, when the program detection device determines that the input value of the first input component matches the first detection value, it determines that the input value of the first input component is an abnormal input value.
[0108] As another schematic description, in the case where the component type includes a numeric input box type, the program detection device matches the input value of the second input component with the second detection value. The described second input component is any one of the multiple input components in the first building block. Additionally, the second detection value can be used to indicate the detection index for indicating non-numeric input in the anomaly detection rule corresponding to the numeric input box type. For example, the second detection value can be the null value, letters, text, or input exceeding the set range mentioned above. Further, when the program detection device determines that the input value of the second input component matches the second detection value, it determines that the input value of the second input component is an abnormal input value.
[0109] As another schematic description, in the case where the component type includes a text input box type, the program detection device matches the input value of the third input component with the third detection value. The described third input component is any one of the multiple input components in the first building block. Additionally, the third detection value can be used to indicate the detection index for indicating non-text input in the anomaly detection rule corresponding to the text input box type. For example, the third detection value can be the null value, numbers, or input exceeding the set range mentioned above. Further, when the program detection device determines that the input value of the third input component matches the third detection value, it determines that the input value of the third input component is an abnormal input value.
[0110] Similarly, when the component type includes a color selection box type, the program detection device matches the input value of the fourth input component with the fourth detection value. The described fourth input component is any one of the multiple input components in the first building block. Additionally, the fourth detection value can be used to indicate the detection metric for numerical input indicating a non-RGB color gamut in the anomaly detection rule corresponding to the color selection box type. For example, the fourth detection value can be a numerical input such as the null value, text, string, etc. mentioned above that is outside the RGB color gamut. Further, when the program detection device determines that the input value of the fourth input component matches the fourth detection value, it determines that the input value of the fourth input component is an abnormal input value.
[0111] In this way, when the program detection device determines that the input value of the input component is an abnormal input value, it can determine that the detection result of the first building block is an abnormal result based on the abnormal input value of the input component. For example, when the input value of any one or more input components is an abnormal input value, it can be determined that the detection result of the first building block is an abnormal result.
[0112] It should be noted that the above describes the process of building block anomaly detection only by taking any one building block (i.e., the first building block) as an example. For the anomaly detection processes of other building blocks, they can be understood by referring to the anomaly detection process of the first building block and will not be elaborated here.
[0113] 604. Determine the code detection result based on the detection result of each building block. The code detection result is used to indicate whether there is a code anomaly in the code program generated in the code editing area. The code program is generated by at least two code blocks and the code logical relationship between at least two code blocks. Each building block corresponds to one code block among at least two code blocks, and the connection relationship between at least two building blocks corresponds to the code logical relationship between at least two code blocks.
[0114] In this example, since the code program is generated based on at least two code blocks and the code logical relationship between at least two code blocks. And in the coding building block environment, each building block can represent a code block. Also, the connection relationship between at least two building blocks corresponds to the code logical relationship between at least two code blocks. Then, to determine whether the code program has an anomaly, it can be determined by judging whether the building blocks have anomalies. Therefore, after the program detection device determines the detection result of each building block through the process in step 603, it can determine the code detection result based on the detection result of each building block. It should be noted that the described code detection result can reflect whether there is a code anomaly in the code program generated in the code editing area. For example, when the detection result of one or more building blocks is an abnormal result, it can be determined that the detection result of the code program is an abnormal detection result.
[0115] In the above manner, building blocks are used to represent code blocks in the scenario of coding building blocks. Furthermore, during the process of generating a code program, the detection result of a building block is determined by detecting the input values of each input component in the building block, thereby determining the code detection result. That is to say, in the embodiments of the present application, it is not necessary to detect whether an exception occurs in the code program only after the code program runs. Instead, during the process of generating the code program, it is determined whether a code exception occurs in the generated code program by whether the input values of the input components in the building block are abnormal, and the code program can be detected for exceptions in real time and in a timely manner, improving the detection efficiency. In addition, in the embodiments of the present application, it is not necessary to build a complete building block model and run the corresponding code program as in the traditional detection method to implement the detection of exceptions in the code program. Instead, during the process of building the building block model, the abnormal conditions of the input values of the input components of each building block are detected to implement the detection of exceptions in the code program, achieving real-time exception feedback, enabling the target object to better understand the state and function of the building block, and improving the user experience.
[0116] In addition, through the above manner, during the process of responding to the trigger operation of the target object on the building block, feedback on whether an exception occurs can be provided in a timely manner, without waiting for the operation result of the code program to determine the exception. In this way, the target object can timely know whether the input values of the input components in the building block are abnormal, and thus, in case of an exception, prompt the target object to take corrective measures in a timely manner, improving the programming efficiency and accuracy.
[0117] In some other alternative examples, from the foregoing Figure 5C It can also be seen that for the prompt message shown in the traditional detection scheme, only the occurrence of an exception in the code program can be known. The target object cannot intuitively understand the reason for the occurrence of the exception from the existing prompt message, and it is also difficult to locate the building block with the exception problem.
[0118] Therefore, in the embodiments of the present application, after detecting that an exception occurs in a building block, it is also necessary to perform exception prompt processing on the building block with the exception. For example, taking the foregoing first building block as an example, after detecting that the detection result of the first building block is an abnormal result, the program detection device can perform exception prompt processing on the first building block. By performing exception prompt processing on the first building block with the exception, the reason for the exception can be intuitively understood, and the building block with the exception can be located in a timely manner, facilitating the timely adoption of a processing strategy to deal with the exception situation. For example, the building block with the exception can be changed or replaced, or a new definition can be given to the building block with the exception, etc. The specific details are not limited in the embodiments of the present application.
[0119] It should be noted that for other abnormal building blocks, similar methods can also be used to implement abnormal prompt processing. Specifically, it can be understood by referring to the processing process of the first building block, which will not be elaborated here.
[0120] In the process of performing abnormal prompt processing on the first building block mentioned above, the following several methods can be referred to for implementation, that is:
[0121] (1) Adjust the background color of the first building block
[0122] Exemplarily, after the program detection device determines that the detection result of the first building block is an abnormal result, it can identify that the first building block has an abnormality. At this time, the program detection device can adjust the background color value of the first building block from the first color value to the second color value to perform abnormal prompt processing on the first building block. The background color corresponding to the described first color value is different from the background color corresponding to the second color value. For example, the program detection device can call the block.setDisabled(true) function provided in Blockly to adjust the background color of the abnormal first building block, such as adjusting it to gray, etc., which is not limited in the specific embodiments of this application. Through the above method, the target object can be prompted to locate the abnormal first building block and visually focus on the first building block.
[0123] For example, Figure 10A shows a schematic diagram of a building block with an abnormality displayed in the existing solution, Figure 10B shows a schematic diagram of a building block with an abnormality displayed in the embodiments of this application.
[0124] From Figure 10A it can be seen that taking the abnormal building block "LED color light module [?]: display ○" as the first building block as an example, for "LED color light module [?]: display ○", only the option in the function module input box is changed to a question mark, and no reasonable input value of the function module is given. This will cause the target object to be difficult to visually focus on the abnormal building block with a question mark as the option during the process of dragging multiple building blocks to generate a code program.
[0125] And from Figure 10B it can be seen that in the embodiments of this application, by adjusting the background color of the first building block, for example, adjusting the background color of the first building block to gray. Compared with Figure 10A the schematic diagram shown, it can play the role of prompting that there is an abnormality in the first building block.
[0126] (2) Highlight or flash the display of the first building block
[0127] Exemplarily, after the program detection device determines that the detection result of the first building block is an abnormal result, it can identify that the first building block has an abnormality. At this time, the program detection device can also highlight or flash the display of the first building block to perform abnormal prompt processing on the first building block. Through the above method, the target object can be prompted to locate the first building block with an abnormality.
[0128] In practical applications, the program detection device can also combine the above methods (1) and (2) to perform abnormal prompt processing on the first building block. That is to say, the program detection device can select one or more processing methods from adjusting the background color of the first building block, flashing the display of the first building block, and highlighting the display of the first building block to implement the abnormal prompt processing of the first building block. Specifically, it is not limited in the embodiments of this application.
[0129] (3) Adjust the border color of the input component corresponding to the abnormal input value in the first building block
[0130] Exemplarily, the program detection device adjusts the border color value of the input component corresponding to the abnormal input value in the first building block from the first border color value to the second border color value to perform abnormal prompt processing on the first building block. The described first border color value is less than the second border color value. For example, the program detection device can call the field.setHighlightColor('#FF0000') function provided in Blockly to adjust the border color value of the input component corresponding to the abnormal input value in the first building block, such as adjusting it to a conspicuous red color, etc. Specifically, it is not limited in the embodiments of this application. Through the above method, the input component with an abnormality in the first building block can be quickly located.
[0131] For example, Figure 11 shows a schematic diagram of displaying an abnormal input component in the embodiments of this application. From Figure 11 it can be seen that taking the abnormal building block "LED color light module [?]: display ○" as the first building block as an example, for "LED color light module [?]: display ○", only the option in the function module input box is changed to a question mark, and no reasonable input value of the function module is given. At this time, according to the method in step 603 above, it can be determined that the input value of the input component [?] is an abnormal input value. At this time, in the embodiments of this application, by adjusting the border color value of the input component [?], such as adjusting it to red, it can play a role in prompting that there is an abnormality in the input component [?] to achieve the positioning of the abnormal input component.
[0132] (4) Highlight or flash the display of the input component corresponding to the abnormal input value in the first building block
[0133] Exemplarily, the program detection device will highlight or flash the input component corresponding to the abnormal input value in the first building block to perform abnormal prompt processing on the first building block.
[0134] In practical applications, the program detection device can also combine the above methods (3) and (4) to perform abnormal prompt processing on the first building block. That is to say, the program detection device can select one or more processing methods from adjusting the border color of the input component corresponding to the abnormal input value in the first building block, flashing the input component corresponding to the abnormal input value, and highlighting the input component corresponding to the abnormal input value to implement the prompt processing of the input component of the abnormal input value in the first building block, thereby implementing the abnormal prompt processing of the first building block. Specific limitations are not described in the embodiments of the present application.
[0135] It should be noted that in addition to the above methods (1) to (4), in practical applications, other methods may also be included to implement the abnormal prompt processing of the first building block, which are not specifically limited in the embodiments of the present application. Exemplarily, after determining the abnormal first building block, the program detection device can also set the state of the first building block to a disabled state during the process of performing abnormal processing based on one or more of the above methods (1) to (4). By disabling the abnormal building block and providing visual prompts, the possibility of the target object making mistakes in subsequent operations can be reduced.
[0136] In some other examples, after detecting that the building block has an abnormal situation, specific abnormal detail information can also be directly displayed to inform the target object of the specific abnormal reason.
[0137] Taking the aforementioned first building block as an example, after detecting that the detection result of the first building block is an abnormal result, the target object can perform a trigger operation on the abnormal first building block by clicking, dragging the cursor, etc. In this way, the program detection device responds to the trigger operation on the first building block and then displays the abnormal detail information of the first building block. For example, in the preset display area of the first building block, the abnormal detail information of the first building block is displayed. For example, the program detection device can call the field.setErrorText('detailed error information') function provided in Blockly to directly display the abnormal detail information of the first building block.
[0138] For example, Figure 12 shows a schematic diagram of displaying abnormal detail information in the embodiments of the present application. From Figure 12It can be seen that taking the abnormal building block "Small LCD Display [?]: Display Character [\"hello\"]" as the first building block as an example, for "Small LCD Display [?]: Display Character [\"hello\"]", only the options in the function module input box are changed to question marks, and reasonable input values for the function module are not given. At this time, according to the method in step 603 described above, the input value of the input component [?] can be determined to be an abnormal input value. Based on this, by responding to the trigger operation for this first building block, the abnormal details information of the first building block can be displayed, for example: the first building block does not specify a running object, etc.
[0139] Or, in some other examples, after detecting that the detection result of the first building block is an abnormal result, the target object can perform a trigger operation on the running control of the code program by clicking or the like. In this way, the program detection device responds to the trigger operation on the running control of the code program, and then displays a prompt message. The described prompt message can indicate the abnormal details information of the first building block. For example, the prompt message can be displayed in the form of a pop-up window, a bubble, etc., and specific limitations are not made in the embodiments of the present application.
[0140] For example, Figure 13 shows a schematic diagram of the prompt message provided by the present application. As Figure 13 shown, taking "R45 Power Wheel [?]: Rotate with
[30] Power" as the abnormal first building block as an example, after triggering the running of the code program, it can be learned from the displayed prompt message that the 4th building block "R45 Power Wheel" does not select the corresponding function module. Compared with the Figure 5C existing abnormal prompt methods shown above, the prompt message in the embodiments of the present application can indicate the abnormal details information of the specific building block where the abnormality occurs, which is convenient for the target object to understand the specific error information and timely adjust the abnormal building block.
[0141] It should be noted that the above-mentioned abnormal details information includes, but is not limited to, the reason for the abnormality, the name of the building block, the position of the building block, etc., and specific limitations are not made in the embodiments of the present application.
[0142] Through the above method, performing abnormal prompt processing on abnormal building blocks can help the target object discover and solve problems more timely and accurately. More specifically, by highlighting, flashing, or changing colors, etc., to display the abnormal building blocks, for objects with visual or cognitive impairments, they can more easily understand and use the visual programming tool through clear visual prompts and state changes. In addition, for objects such as children and novice programmers, the real-time feedback of abnormal situations and obvious visual prompts in the present application can also help them master programming concepts and skills faster and improve the learning effect.
[0143] The above mainly introduces the solution provided by the embodiments of the present application from the perspective of methods. It can be understood that in order to implement the above functions, it includes the corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should easily realize that, in combination with the modules and algorithm steps of each example described in the embodiments disclosed in the present application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the form of hardware or computer software driving the hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0144] The embodiments of the present application can divide the device into functional modules according to the above method examples. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiments of the present application is illustrative, only a logical function division, and there can be other division methods in actual implementation.
[0145] The following will describe in detail the program detection device in the embodiments of the present application. Figure 14 It is a schematic diagram of an embodiment of the program detection device provided in the embodiments of the present application. As Figure 14 shown, the program detection device may include an acquisition unit 1401, a display unit 1402, and a processing unit 1403.
[0146] Among them, the acquisition unit 1401 is used to acquire an operation event, and the operation event is an event when operating on at least two building blocks in the building block editing area. Specifically, it can be understood by referring to the content described in step 601 above, and details are not described here. Figure 6 in the above.
[0147] The display unit 1402 is used to display one or more input components of each building block in response to a trigger operation for the operation event, and each input component is a component that receives a selection operation on the functional attribute of the building block. Specifically, it can be understood by referring to the content described in step 602 above, and details are not described here. Figure 6 in the above.
[0148] The processing unit 1403 is used to traverse and detect the input values of each corresponding input component in each building block to obtain a detection result corresponding to the building block. Specifically, it can be understood by referring to the content described in step 603 above, and details are not described here. Figure 6 in the above.
[0149] The processing unit 1403 is configured to determine a code detection result based on the detection result of each building block, where the code detection result is used to indicate whether a code exception occurs in a code program generated in a code editing area; wherein, the code program is generated by at least two code blocks and the code logic relationship between the at least two code blocks, each building block corresponds to one code block of the at least two code blocks, and the connection relationship between the at least two building blocks corresponds to the code logic relationship between the at least two code blocks. Specifically, reference may be made to the content described in step 604 of the foregoing Figure 6 for understanding, and details are not described herein again.
[0150] In some alternative embodiments, the processing unit 1403 is configured to: for a first building block, determine a component type corresponding to each input component in the first building block based on the configuration information of each input component in the first building block, where the first building block is any one of the at least two building blocks; determine an exception detection rule corresponding to the component type of the corresponding input component based on the component type of each input component and a preset mapping relationship, where the preset mapping relationship is used to indicate the relationship between the component type and the exception detection rule; traverse each input component, and when the input value of the input component matches the corresponding exception detection rule, determine that the input value of the corresponding input component is an abnormal input value; and determine that the detection result of the first building block is an abnormal result based on the abnormal input value of the input component.
[0151] In some other alternative embodiments, the component type includes a function module input box type; the processing unit 1403 is configured to: when the input value of a first input component matches a first detection value, determine that the input value of the first input component is an abnormal input value; where the first input component is any one of a plurality of input components in the first building block, and the first detection value is used to indicate a detection index for indicating an invalid input in the exception detection rule corresponding to the function module input box type.
[0152] In some other alternative embodiments, the component type includes a digital input box type; the processing unit 1403 is configured to: when the input value of a second input component matches a second detection value, determine that the input value of the second input component is an abnormal input value; where the second input component is any one of a plurality of target input components in the first building block, and the second detection value is used to indicate a detection index for indicating a non-numeric input in the exception detection rule corresponding to the digital input box type.
[0153] In some other alternative embodiments, the component type includes a text input box type; the processing unit 1403 is configured to: when the input value of the third input component matches the third detection value, determine that the input value of the third input component is an abnormal input value; wherein, the third input component is any one of the multiple target input components in the first building block, and the third detection value is used to indicate the detection index for non-text input in the abnormal detection rule corresponding to the text input box type.
[0154] In some other alternative embodiments, the component type includes a color selection box type; the processing unit 1403 is configured to: when the input value of the fourth input component matches the fourth detection value, determine that the input value of the fourth input component is an abnormal input value; wherein, the fourth input component is any one of the multiple target input components in the first building block, and the fourth detection value is used to indicate the detection index for no color value input in the abnormal detection rule corresponding to the color selection box type.
[0155] In some other alternative embodiments, the processing unit 1403 is further configured to: after determining that the detection result of the first building block is an abnormal result based on the abnormal input value of the input component, perform an abnormal prompt process on the first building block.
[0156] In some other alternative embodiments, the processing unit 1403 is configured to: adjust the background color value of the first building block from a first color value to a second color value to perform an abnormal prompt process on the first building block, and the background color corresponding to the first color value is different from the background color corresponding to the second color value.
[0157] In some other alternative embodiments, the processing unit 1403 is configured to: highlight or flash the display of the first building block to perform an abnormal prompt process on the first building block.
[0158] In some other alternative embodiments, the processing unit 1403 is configured to: adjust the border color value of the input component corresponding to the abnormal input value in the first building block from a first border color value to a second border color value to perform an abnormal prompt process on the first building block, and the first border color value is less than the second border color value.
[0159] In some other alternative embodiments, the processing unit 1403 is configured to: highlight or flash the display of the input component corresponding to the abnormal input value in the first building block to perform an abnormal prompt process on the first building block.
[0160] In some other alternative embodiments, the processing unit 1403 is further configured to: after determining that the detection result of the first building block is an abnormal result based on the abnormal input value of the input component, in response to a trigger operation on the first building block, display the abnormal detail information of the first building block.
[0161] In some other alternative embodiments, the processing unit 1403 is further configured to: after determining that the detection result of the first building block is an abnormal result based on the abnormal input value of the input component, in response to a trigger operation on the operation control of the code program, display a prompt message for indicating the abnormal detail information of the first building block.
[0162] In some other alternative embodiments, the obtaining unit 1401 is further configured to: before the obtaining operation event, obtain building block configuration information and an extension identifier, where the building block configuration information includes an extension field, and the extension identifier is used to identify at least one functional module. The processing unit 1403 is configured to map the extension identifier to the extension field to generate a building block.
[0163] In some other alternative embodiments, the processing unit 1403 is configured to determine that the detection result of the code program is an abnormal detection result when the detection results of one or more of the building blocks are abnormal results.
[0164] The above describes the program detection device in the embodiments of the present application from the perspective of modular functional entities. The following describes the program detection device in the embodiments of the present application from the perspective of hardware processing. Figure 15 FIG. is a schematic structural diagram of a program detection device provided by an embodiment of the present application. The program detection device may vary greatly due to different configurations or performances. The program detection device may include at least one processor 1501, a communication line 1507, a memory 1503, and at least one communication interface 1504.
[0165] The processor 1501 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the solution of the present application.
[0166] The communication line 1507 may include a path for transmitting information between the above components.
[0167] The communication interface 1504, using any transceiver-like device, is used to communicate with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc.
[0168] The memory 1503 can be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions. The memory can exist independently and be connected to the processor through the communication line 1507. The memory can also be integrated with the processor.
[0169] Among them, the memory 1503 is used to store computer execution instructions for implementing the solution of this application, and is controlled by the processor 1501 to execute. The processor 1501 is used to execute the computer execution instructions stored in the memory 1503, so as to implement the program detection method provided in the above embodiments of this application.
[0170] Optionally, the computer execution instructions in the embodiments of this application can also be referred to as application program code, and the embodiments of this application do not make specific limitations on this.
[0171] In specific implementation, as an embodiment, the program detection device may include multiple processors, such as Figure 15 the processor 1501 and the processor 1502 in. Each of these processors can be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. Here, the processor can refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0172] In specific implementation, as an embodiment, the program detection device may further include an output device 1505 and an input device 1506. The output device 1505 communicates with the processor 1501 and can display information in various ways. The input device 1506 communicates with the processor 1501 and can receive inputs from the target object in various ways. For example, the input device 1506 can be a mouse, a touch screen device, a sensing device, etc.
[0173] The above program detection device can be a general device or a special device. In specific implementation, the program detection device can be a server, a terminal, etc. or a device with a Figure 15 similar structure in. The embodiments of this application do not limit the type of the program detection device.
[0174] It should be noted that Figure 15 the processor 1501 in Figure 6 can cause the program detection device to execute the method in the corresponding method embodiment by calling the computer-executable instructions stored in the memory 1503 as Figures 10A to 13 shown.
[0175] Specifically, Figure 14 the functions / implementation processes of the display unit 1402 and the processing unit 1403 in Figure 15 can be implemented by the processor 1501 in Figure 14 calling the computer-executable instructions stored in the memory 1503. Figure 15 The functions / implementation processes of the acquisition unit 1401 in
[0176] This application embodiment also provides a computer storage medium. Among them, the computer storage medium stores a computer program for electronic data exchange, and the computer program causes the computer to execute part or all of the steps of any one of the program detection methods described in the above method embodiments.
[0177] This application embodiment also provides a computer program product. The computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause the computer to execute part or all of the steps of any one of the program detection methods described in the above method embodiments.
[0178] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.
[0179] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described systems, devices, and units can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0180] In several embodiments provided by this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling, direct coupling, or communication connection can be through some interfaces, and the indirect coupling or communication connection of devices or units can be in electrical, mechanical, or other forms.
[0181] The unit described as a separation component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place or distributed across multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0182] In addition, each functional unit in various embodiments of the present application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0183] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of the present application. The aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs, etc., all kinds of media that can store program codes.
[0184] The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.
[0185] A computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, a process or function according to the embodiments of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more integrated available media. The available medium may be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as an SSD), etc.
[0186] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for program detection, characterized in that Including: Obtain an operation event, where the operation event is an event when operating on at least two building blocks in a building block editing area. The building blocks correspond to building block configuration information, and the building block configuration information includes the type identifier, input component, output slot, text label, and appearance style of the building block. In response to a trigger operation for the operation event, display the function attributes of each building block and one or more of the input components. The function attributes are used to indicate performing an assignment operation in the input components. Each input component is a component for receiving the assignment operation performed on the function attributes of the building block. The types of the input components include function module input box type, digital input box type, text input box type, and color selection box type. For a first building block, based on the configuration information of each input component in the first building block, determine the component type corresponding to the input component, where the first building block is any one of the at least two building blocks. Based on the component type of each input component and a preset mapping relationship, determine an anomaly detection rule corresponding to the component type of the corresponding input component. The preset mapping relationship is used to indicate the relationship between the component type and the anomaly detection rule. Traverse each input component, and when the input value of the input component matches the corresponding anomaly detection rule, determine the input value of the corresponding input component as an abnormal input value. Among them, perform an anomaly prompt process on the input component including the abnormal input value in the first building block. Based on the abnormal input value of the input component, determine that the detection result of the first building block is an abnormal result. When the detection results of one or more of the building blocks are abnormal results, determine that the detection result of the code program is an abnormal detection result. The code detection result is used to indicate whether there is a code anomaly in the code program generated in the code editing area. The code program is generated by at least two code blocks and the code logic relationship between the at least two code blocks. Each building block corresponds to one code block among the at least two code blocks, and the connection relationship between the at least two building blocks corresponds to the code logic relationship between the at least two code blocks.
2. The method according to claim 1, characterized in that, The component type includes the function module input box type. When the input value of the input component matches the corresponding anomaly detection rule, determining that the input value of the corresponding input component is an abnormal input value includes: When the input value of the first input component matches the first detection value, determine that the input value of the first input component is an abnormal input value. Among them, the first input component is any one of the multiple input components in the first building block, and the first detection value is used to indicate the detection index for indicating invalid input in the anomaly detection rule corresponding to the function module input box type.
3. The method according to claim 1, wherein The component type includes the digital input box type. When the input value of the input component matches the corresponding anomaly detection rule, determining that the input value of the corresponding input component is an abnormal input value includes: When the input value of the second input component matches the second detection value, determine that the input value of the second input component is an abnormal input value; Wherein, the second input component is any one of the multiple input components in the first building block, and the second detection value is used to indicate the detection index for indicating non-numeric input in the abnormal detection rule corresponding to the digital input box type.
4. The method according to claim 1, wherein The component type includes a text input box type; when the input value of the input component matches the corresponding abnormal detection rule, determining that the input value of the corresponding input component is an abnormal input value includes: When the input value of the third input component matches the third detection value, determine that the input value of the third input component is an abnormal input value; Wherein, the third input component is any one of the multiple input components in the first building block, and the third detection value is used to indicate the detection index for indicating non-text input in the abnormal detection rule corresponding to the text input box type.
5. The method according to claim 1, characterized in that, The component type includes a color selection box type; when the input value of the input component matches the corresponding abnormal detection rule, determining that the input value of the corresponding input component is an abnormal input value includes: When the input value of the fourth input component matches the fourth detection value, determine that the input value of the fourth input component is an abnormal input value; Wherein, the fourth input component is any one of the multiple input components in the first building block, and the fourth detection value is used to indicate the detection index for indicating no color value input in the abnormal detection rule corresponding to the color selection box type.
6. The method according to any one of claims 1 to 5, characterized in that, After determining that the detection result of the first building block is an abnormal result based on the abnormal input value of the input component, the method further includes: Performing an abnormal prompt process on the first building block.
7. The method according to claim 6, characterized in that The performing an abnormal prompt process on the first building block includes: Adjusting the background color value of the first building block from the first color value to the second color value to perform an abnormal prompt process on the first building block, and the background color corresponding to the first color value is different from the background color corresponding to the second color value.
8. The method according to claim 6, wherein The performing an abnormal prompt process on the first building block includes: Highlighting or flashing the display of the first building block to perform an abnormal prompt process on the first building block.
9. The method according to claim 6, wherein The performing an abnormal prompt process on the first building block includes: Adjusting the border color value of the input component corresponding to the abnormal input value in the first building block from the first border color value to the second border color value to perform an abnormal prompt process on the first building block, and the first border color value is less than the second border color value.
10. The method according to claim 6, characterized in that, The performing an abnormal prompt process on the first building block includes: Highlighting or flashing the display of the input component corresponding to the abnormal input value in the first building block to perform an abnormal prompt process on the first building block.
11. The method according to any one of claims 1 to 5, characterized in that, After determining that the detection result of the first building block is an abnormal result based on the abnormal input value of the input component, the method further includes: In response to a trigger operation for the first building block, displaying the abnormal detail information of the first building block.
12. The method according to any one of claims 1 to 5, characterized in that, After determining that the detection result of the first building block is an abnormal result based on the abnormal input value of the input component, the method further includes: In response to a trigger operation on the operation control of the code program, display a prompt message for indicating the abnormal detail information of the first building block.
13. The method according to any one of claims 1 to 5, characterized in that, Before the obtaining operation event, the method further includes: Obtain the building block configuration information and an extension identifier, where the building block configuration information includes an extension field, and the extension identifier is used to identify at least one functional module; Map the extension identifier to the extension field to generate a building block.
14. A program detection device, characterized in that, Includes: An obtaining unit, configured to obtain an operation event, where the operation event is an event when operating on at least two building blocks in a building block editing area, the building blocks correspond to building block configuration information, and the building block configuration information includes a type identifier, an input component, an output slot, a text label, and an appearance style of the building block; A display unit, configured to display the functional attribute of each building block and one or more of the input components in response to a trigger operation on the operation event, where the functional attribute is used to indicate an assignment operation in the input component, and each input component is a component that receives the assignment operation on the functional attribute of the building block, and the types of the input components include a functional module input box type, a numeric input box type, a text input box type, and a color selection box type; A processing unit, configured to, for a first building block, determine the component type corresponding to the input component based on the configuration information of each input component in the first building block, where the first building block is any one of the at least two building blocks; determine an abnormal detection rule corresponding to the component type of the input component based on the component type of each input component and a preset mapping relationship, where the preset mapping relationship is used to indicate the relationship between the component type and the abnormal detection rule; traverse each input component, and when the input value of the input component matches the corresponding abnormal detection rule, determine that the input value of the input component is an abnormal input value; and perform abnormal prompt processing on the input component including the abnormal input value in the first building block; The processing unit is configured to determine that the detection result of the code program is an abnormal detection result when the detection results of one or more of the building blocks are abnormal results, where the code detection result is used to indicate whether a code exception occurs in the code program generated in the code editing area, the code program is generated by at least two code blocks and the code logic relationship between the at least two code blocks, each building block corresponds to one code block of the at least two code blocks, and the connection relationship between the at least two building blocks corresponds to the code logic relationship between the at least two code blocks.
15. The device according to claim 14, characterized in that, The component type includes a function module input box type; the processing unit is configured to: when the input value of the first input component matches the first detection value, determine that the input value of the first input component is an abnormal input value; wherein, the first input component is any one of the multiple input components in the first building block, and the first detection value is used to indicate the detection index for indicating invalid input in the abnormal detection rule corresponding to the function module input box type.
16. The device according to claim 14, characterized in that, The component type includes a numeric input box type; the processing unit is configured to: when the input value of the second input component matches the second detection value, determine that the input value of the second input component is an abnormal input value; wherein, the second input component is any one of the multiple input components in the first building block, and the second detection value is used to indicate the detection index for indicating non-numeric input in the abnormal detection rule corresponding to the numeric input box type.
17. The device according to claim 14, wherein The component type includes a text input box type; the processing unit is configured to: when the input value of the third input component matches the third detection value, determine that the input value of the third input component is an abnormal input value; wherein, the third input component is any one of the multiple input components in the first building block, and the third detection value is used to indicate the detection index for indicating non-text input in the abnormal detection rule corresponding to the text input box type.
18. The device according to claim 14, characterized in that, The component type includes a color selection box type; the processing unit is configured to: when the input value of the fourth input component matches the fourth detection value, determine that the input value of the fourth input component is an abnormal input value; wherein, the fourth input component is any one of the multiple input components in the first building block, and the fourth detection value is used to indicate the detection index for indicating no color value input in the abnormal detection rule corresponding to the color selection box type.
19. The device according to any one of claims 14 to 18, characterized in that, The processing unit is further configured to: after determining that the detection result of the first building block is an abnormal result based on the abnormal input value of the input component, perform an abnormal prompt process on the first building block.
20. The device according to claim 19, characterized in that The processing unit is configured to: adjust the background color value of the first building block from the first color value to the second color value to perform an abnormal prompt process on the first building block, and the background color corresponding to the first color value is different from the background color corresponding to the second color value.
21. The device according to claim 19, characterized in that, The processing unit is configured to: highlight or flash the display of the first building block to perform an abnormal prompt process on the first building block.
22. The device according to claim 19, wherein, The processing unit is configured to: adjust the border color value of the input component corresponding to the abnormal input value in the first building block from the first border color value to the second border color value to perform an abnormal prompt process on the first building block, and the first border color value is less than the second border color value.
23. The device according to claim 19, characterized in that, The processing unit is configured to: highlight or flash the display of the input component corresponding to the abnormal input value in the first building block to perform an abnormal prompt process on the first building block.
24. The device according to any one of claims 14 to 18, characterized in that The processing unit is further configured to: after determining that the detection result of the first building block is an abnormal result based on the abnormal input value of the input component, display the abnormal detail information of the first building block in response to a trigger operation on the first building block.
25. The device according to any one of claims 14 to 18, characterized in that, The processing unit is further configured to: after determining that the detection result of the first building block is an abnormal result based on the abnormal input value of the input component, display a prompt message in response to a trigger operation on the operation control of the code program, where the prompt message is used to indicate the abnormal detail information of the first building block.
26. The device according to any one of claims 14 to 18, characterized in that, The obtaining unit is further configured to: before the obtaining operation event, obtain building block configuration information and an extension identifier, where the building block configuration information includes extension fields, and the extension identifier is used to identify at least one functional module; The processing unit is configured to map the extension identifier to the extension fields to generate a building block.
27. A program detection device, characterized in that, Comprising: An input / output interface, a processor, and a memory, where program instructions are stored in the memory; The processor is configured to execute the program instructions stored in the memory and execute the method according to any one of claims 1 to 13.
28. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes instructions that, when run on a computer device, cause the computer device to execute the method according to any one of claims 1 to 13.
29. A computer program product, characterized in that, The computer program product includes instructions that, when run on a computer device, cause the computer device to execute the method according to any one of claims 1 to 13.
Citation Information
Patent Citations
Visualization programming tool based on flow chart
CN109634596A
Graphical algorithm programming interaction system, programming method and readable storage medium
CN111338619A