Low-code platform code optimization method and device based on dependency relationship and medium

By using static code analysis tools on low-code platforms to identify and optimize the dependencies between functional modules, generate dependency diagrams and optimize them, the problem of excessive dependencies between modules in low-code platform code is solved, and the code maintainability and execution efficiency is improved.

CN120216017APending Publication Date: 2025-06-27SHANDONG INSPUR SCI RES INST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510367842.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-26
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

There are too many direct dependencies between modules in the code generated by existing low-code platforms, resulting in low code maintenance, lengthy and inefficient codes, and lack of systematic dependency management, which affects development efficiency and system stability.

Method used

The initial code is obtained by accessing the low-code platform, and the static code analysis tool is used to identify the dependencies between functional modules, generate dependency graphs, perform complexity analysis, label high-coupling and high-dependence modules, determine the optimization path based on the dependency graph and dependency minimization strategy, perform decoupling optimization and redundancy elimination, and generate optimization code.

Benefits of technology

It improves the maintainability, scalability and execution efficiency of code, reduces the coupling degree and dependence depth between modules, and enhances the stability and development efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120216017A_ABST
    Figure CN120216017A_ABST
Patent Text Reader

Abstract

The invention discloses a low-code platform code optimization method and device based on a dependency relationship and a medium, and belongs to the technical field of low-code platform code optimization. The method comprises the following steps: accessing a low-code platform to obtain an initial code generated by the low-code platform; processing the initial code based on a preset static code analysis tool to obtain a dependency relationship among the plurality of functional modules; generating a dependency graph based on the dependency; performing complexity analysis on the dependency graph to calculate the coupling degree and the dependency depth among the plurality of functional modules, and marking the to-be-processed module; processing the to-be-processed modules based on the dependency relationship graph and a preset dependency minimization strategy to determine optimized paths of the plurality of to-be-processed modules; and reconstructing the initial code based on the optimized path, and adjusting the calling relationship among the plurality of functional modules to generate the optimized code. According to the method disclosed by the invention, the code quality is improved through the dependency relationship.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of code optimization for low-code platforms, and particularly to a method, device, and medium for optimizing the code of a low-code platform based on dependency relationships. Background Art

[0002] A low-code platform (LCDP) is a development platform that can quickly generate application programs without coding (0 code) or with a small amount of code. By using a method of visual application development (refer to visual programming languages), developers with different experience levels can create web and mobile application programs through a graphical user interface, using drag-and-drop components and model-driven logic.

[0003] However, in the prior art, there are too many direct dependencies between modules in the code generated by low-code platforms, resulting in a chain reaction in other modules when modifying a certain module, reducing the maintainability of the code; at the same time, there are unnecessary redundant dependencies between modules, making the code verbose and inefficient, further increasing the maintenance difficulty and system complexity. In addition, the lack of systematic dependency management leads to a large mutual influence between modules, making it difficult to conduct individual debugging and testing, affecting the development efficiency of the code and the system stability.

[0004] Therefore, how to improve code quality through dependency relationships has become a technical problem to be solved urgently. Summary of the Invention

[0005] Embodiments of this application provide a method, device, and storage medium for optimizing the code of a low-code platform based on dependency relationships to solve the following technical problem: how to improve code quality through dependency relationships.

[0006] In a first aspect, an embodiment of the present application provides a method for optimizing code of a low-code platform based on dependency relationships. The method includes: accessing the low-code platform to obtain initial code generated by the low-code platform; wherein the initial code includes multiple functional modules, and each functional module includes code for at least one function; processing the initial code based on a preset static code analysis tool to obtain the dependency relationships between the multiple functional modules; wherein the dependency relationships include strong dependencies, weak dependencies, and redundant dependencies; generating a dependency graph based on the dependency relationships; wherein the dependency graph includes multiple nodes and multiple edges, the nodes represent functional modules, and the edges represent the dependency relationships between the functional modules; performing complexity analysis on the dependency graph to calculate the coupling degree and dependency depth between the multiple functional modules, and marking the modules to be processed; wherein the modules to be processed include highly coupled modules and highly dependent modules; processing the modules to be processed based on the dependency graph and a preset dependency minimization strategy to determine the optimization paths for the multiple modules to be processed; wherein the optimization paths include decoupling optimization and redundancy elimination; reconstructing the initial code based on the optimization paths, adjusting the call relationships between the multiple functional modules, to generate optimized code.

[0007] In an implementation manner of the present application, processing the initial code based on a preset static code analysis tool to obtain the dependency relationships between the multiple functional modules specifically includes: identifying the input relationships, output relationships, and call relationships between the functional modules based on the static code analysis tool; constructing a dependency matrix of the input relationships, output relationships, call relationships, and dependency relationships; processing the input relationships, output relationships, and call relationships based on the dependency matrix to determine the dependency relationships between the multiple functional modules.

[0008] In an implementation manner of the present application, generating a dependency graph based on the dependency relationships specifically includes: mapping the multiple functional modules to multiple nodes in the dependency graph; wherein each node corresponds to a functional module; generating multiple directed edges to connect the multiple nodes according to the dependency direction and dependency type of the dependency relationships; labeling the multiple directed edges with dependency type labels based on the dependency relationships to generate the dependency graph; wherein the dependency type labels include strong dependency label symbols, weak dependency label symbols, and redundant dependency label symbols.

[0009] In an implementation manner of the present application, complexity analysis is performed on the dependency graph to calculate the coupling degree and dependency depth among multiple functional modules, and the modules to be processed are marked. Specifically, it includes: determining any node, and determining the coupling degree of the functional module corresponding to any node based on the number of directed edges of any node in the dependency graph; determining any node, and counting the number of edges from any node in the dependency graph to other nodes in the dependency graph, and taking the number of the maximum number of edges as the dependency depth of the functional module corresponding to any node; determining the coupling degree threshold and the dependency degree threshold, and marking the nodes greater than the coupling degree threshold as high-coupling modules, and marking the nodes greater than the dependency degree threshold as high-dependency modules.

[0010] In an implementation manner of the present application, the modules to be processed are processed based on the dependency graph and the preset dependency minimization strategy to determine the optimization paths of multiple modules to be processed. Specifically, it includes: determining the modules to be stripped of the module to be processed based on the dependency relationship between the functional module connected to the module to be processed and the module to be processed, so as to determine the first optimization path; wherein, the module to be stripped is the function in the module to be processed that is depended on by more than two functional modules connected to the module to be processed; processing the module to be processed based on the static analysis tool and the preset detection rules to identify the dependency relationships that the module to be processed is not actually called, so as to determine the second optimization path; determining the optimization path based on the first optimization path and the second optimization path.

[0011] In an implementation manner of the present application, based on the optimization path, the initial code is refactored to adjust the call relationships among multiple functional modules to generate optimized code. Specifically, it includes: extracting the code related to the module to be stripped from the module to be processed to generate an independent functional module, and updating the connection relationships in the dependency graph to generate the first optimized dependency graph; removing the dependency code corresponding to the second optimization path in the module to be processed, and updating the dependency graph to delete the directed edges and dependency type labels associated with the second optimization path in the first optimized dependency graph to generate the second optimized dependency graph; processing the second optimized dependency graph based on the static analysis tool to perform static analysis verification on the refactored code to generate a verification result; when the verification result is verified to pass, outputting the optimized code.

[0012] In an implementation manner of the present application, after extracting the code related to the module to be stripped from the module to be processed to generate an independent functional module, the method further includes: encapsulating the independent functional module; wherein, the independently encapsulated module includes an interface for being called by other than the encapsulated functional module.

[0013] In an implementation manner of the present application, the method further includes: constructing a module-dependency health quantification model, and evaluating the coupling degree and dependency depth of the dependency relationship graph, the first dependency relationship graph, and the second dependency relationship graph based on the module-dependency health quantification model; processing the coupling degree and dependency depth based on a preset health weight to generate a health score.

[0014] In a second aspect, an embodiment of the present application further provides a low-code platform code optimization device based on a dependency relationship. The device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to: access a low-code platform to obtain initial code generated by the low-code platform; wherein the initial code includes multiple functional modules, and each functional module includes code for at least one function; process the initial code based on a preset static code analysis tool to obtain the dependency relationships between the multiple functional modules; wherein the dependency relationships include strong dependencies, weak dependencies, and redundant dependencies; generate a dependency relationship graph based on the dependency relationships; wherein the dependency relationship graph includes multiple nodes and multiple edges, the nodes represent functional modules, and the edges represent the dependency relationships between the functional modules; perform complexity analysis on the dependency relationship graph to calculate the coupling degree and dependency depth between the multiple functional modules, and mark the modules to be processed; wherein the modules to be processed include highly coupled modules and highly dependent modules; process the modules to be processed based on the dependency relationship graph and a preset dependency minimization strategy to determine the optimization paths for the multiple modules to be processed; wherein the optimization paths include decoupling optimization and redundancy elimination; reconstruct the initial code based on the optimization paths, and adjust the call relationships between the multiple functional modules to generate optimized code.

[0015] Thirdly, an embodiment of the present application also provides a non-volatile computer storage medium for optimizing the code of a low-code platform based on dependency relationships, storing computer-executable instructions, characterized in that the computer-executable instructions are set as follows: accessing the low-code platform to obtain the initial code generated by the low-code platform; wherein, the initial code includes multiple functional modules, and each functional module includes the code of at least one function; processing the initial code based on a preset static code analysis tool to obtain the dependency relationships between the multiple functional modules; wherein, the dependency relationships include strong dependencies, weak dependencies, and redundant dependencies; generating a dependency graph based on the dependency relationships; wherein, the dependency graph includes multiple nodes and multiple edges, the nodes represent functional modules, and the edges represent the dependency relationships between the functional modules; performing complexity analysis on the dependency graph to calculate the coupling degree and dependency depth between the multiple functional modules, and marking the modules to be processed; wherein, the modules to be processed include high-coupling modules and high-dependency modules; processing the modules to be processed based on the dependency graph and a preset dependency minimization strategy to determine the optimization paths for the multiple modules to be processed; wherein, the optimization paths include decoupling optimization and redundancy elimination; reconstructing the initial code based on the optimization paths, adjusting the call relationships between the multiple functional modules, to generate optimized code.

[0016] A method, device, and medium for optimizing the code of a low-code platform based on dependency relationships provided by an embodiment of the present application obtain the initial code by accessing the low-code platform, and identify the dependency relationships between functional modules, including strong dependencies, weak dependencies, and redundant dependencies, through a static code analysis tool, providing a data basis for code optimization; by generating a dependency graph, visually displaying the complex connections between modules, facilitating developers to quickly understand the code structure. The complexity analysis further quantifies the coupling degree and dependency depth between modules to accurately mark high-coupling modules and high-dependency modules to a certain extent, providing a target for the optimization work; determining targeted optimization paths based on the dependency graph and the dependency minimization strategy to effectively reduce the coupling degree and dependency depth between modules to a certain extent, improving the maintainability, scalability, and execution efficiency of the code. Thus, the code quality is improved. Description of the Drawings

[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings:

[0018] Figure 1 It is a flowchart of a method for optimizing the code of a low-code platform based on dependency relationships provided by an embodiment of the present application;

[0019] Figure 2 It is a schematic internal structure diagram of a device for optimizing the code of a low-code platform based on dependency relationships provided by an embodiment of the present application. Detailed implementation manners

[0020] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Apparently, the described embodiments are only a part rather than all of the embodiments of this application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts shall fall within the scope of protection of this application.

[0021] The embodiments of this application provide a method, device, and storage medium for optimizing the code of a low-code platform based on dependency relationships to solve the following technical problem: how to improve code quality through dependency relationships.

[0022] The technical solutions proposed in the embodiments of this application will be described in detail below with reference to the drawings.

[0023] Figure 1 This is a flowchart for optimizing the code of a low-code platform based on dependency relationships provided by the embodiments of this application. As Figure 1 shown, a method for optimizing the code of a low-code platform based on dependency relationships provided by the embodiments of this application specifically includes the following steps:

[0024] Step 1: Access the low-code platform to obtain the initial code generated by the low-code platform; among them, the initial code includes multiple functional modules, and each functional module includes the code of at least one function.

[0025] First, log in to the developer platform.

[0026] After logging in, according to the graphical design tool of the low-code platform, design the user interface and business logic of the application program by dragging components, configuring attributes, setting event handling, etc.

[0027] After the design is completed, the low-code platform automatically generates the initial code of the application program according to the configuration. These initial codes include multiple functional modules, and each functional module encapsulates the code for implementing specific business logics, such as data processing, user interface rendering, event handling, etc.

[0028] In a specific example, a library management system is constructed. The initial code of the library management system includes a book information management module, a user management module, and a borrowing management module. The book information management module is responsible for adding, deleting, modifying, and querying books; the user management module is responsible for user registration, login, and information update; the borrowing management module is responsible for handling the borrowing and returning processes of books.

[0029] Step 2: Process the initial code based on a preset static code analysis tool to obtain the dependency relationships between multiple functional modules; among them, the dependency relationships include strong dependencies, weak dependencies, and redundant dependencies.

[0030] Use a static code analysis tool to analyze the initial code to reveal the dependency relationships between functional modules, providing a basis for subsequent code optimization and refactoring. The specific steps refer to Step 21 to Step 23.

[0031] Step 21: Identify the input relationships, output relationships, and call relationships between functional modules based on the static code analysis tool.

[0032] Input relationship: It refers to the relationship where a functional module receives data or signals from other modules. For example, in a library management system, the borrowing management module obtains the inventory information of books from the book information management module to determine whether the books can be borrowed.

[0033] Output relationship: It refers to the relationship where a functional module sends data or signals to other modules. For example, when the book information management module adds a new book, it notifies the user interface module to update the book list.

[0034] Call relationship: It refers to the relationship where a functional module directly calls the functions or methods of another functional module. For example, when the borrowing management module processes a borrowing request, it will call the query book function of the book information management module.

[0035] Select or develop a static code analysis tool suitable for the code format generated by the low-code platform, import the initial code into the static code analysis tool, perform code parsing and syntax analysis, and the tool automatically identifies and extracts the input relationships, output relationships, and call relationships between functional modules.

[0036] Step 22: Construct a dependency matrix for the input relationships, output relationships, call relationships, and dependency relationships.

[0037] Based on the relationship information extracted by the static code analysis tool, construct a dependency matrix. The rows and columns of the matrix represent different functional modules respectively, and the elements in the matrix represent the relationship types and strengths between modules, such as input, output, call, and dependency (strong dependency, weak dependency, redundant dependency). The dependency matrix can be a two-dimensional table, where each element corresponds to a specific relationship type and strength.

[0038] Step 23: Process the input relationships, output relationships, and call relationships based on the dependency matrix to determine the dependency relationships between multiple functional modules.

[0039] By analyzing the dependency matrix, identify the dependency relationships between functional modules, which will not be elaborated here.

[0040] Step 3: Generate a dependency graph based on the dependencies; where the dependency graph includes multiple nodes and multiple edges, the nodes represent functional modules, and the edges represent the dependencies between the functional modules.

[0041] To clearly show the dependencies between functional modules, a dependency graph is generated. The dependency graph will consist of multiple nodes and multiple edges, where the nodes represent functional modules and the edges represent the dependencies between these modules.

[0042] Step 31: Map multiple functional modules to multiple nodes in the dependency graph; where each node corresponds to a functional module.

[0043] First, identify all functional modules. Functional modules are relatively independent and have specific functions, such as user management, book entry, book borrowing, and book return modules in a library management system.

[0044] Furthermore, map each functional module to a node in the dependency graph. Nodes are the basic elements in the graph and are used to represent the existence of functional modules. Each node should have a unique identifier to accurately distinguish different functional modules in the graph. For example, in a library management system, the "user management module" can be mapped to a node labeled "user management" with the node identifier UM.

[0045] Step 32: Generate multiple directed edges to connect the multiple nodes according to the dependency direction and dependency type of the dependencies.

[0046] After determining all the nodes, analyze the dependencies between the functional modules and generate directed edges to connect the corresponding nodes according to the dependencies.

[0047] Dependencies are directional, that is, one functional module (source module) depends on the function provided by another functional module (target module). For example, in a library management system, the "book borrowing module" depends on the "user management module" to verify the user's identity, which forms a dependency relationship from the "book borrowing module" to the "user management module".

[0048] Dependency type is used to describe the strength and nature of the dependency relationship. In the embodiments of the present application, three dependency types are defined: strong dependency, weak dependency, and redundant dependency.

[0049] Strong dependency means that the source module cannot work properly unless the target module provides the required function;

[0050] Weak dependency means that the source module can work without the target module, but some functions may be restricted or the performance may decline;

[0051] A redundant dependency indicates that the dependency relationship between the source module and the target module is unnecessary and can be removed to simplify the system structure.

[0052] According to the direction and type of the dependency, corresponding directed edges are generated in the dependency graph. A directed edge is a line segment with a direction, used to connect the source node and the target node, and indicates that the module corresponding to the source node depends on the module corresponding to the target node.

[0053] To distinguish different types of dependencies, different line styles or colors can be used to represent strong dependencies, weak dependencies, and redundant dependencies.

[0054] For example, a strong dependency can be represented by a solid line, a weak dependency can be represented by a dashed line, and a redundant dependency can be represented by a dotted line.

[0055] Step 33: Based on the dependency relationship, label the dependency type tags for multiple directed edges to generate a dependency graph; among them, the dependency type tags include strong dependency tag symbols, weak dependency tag symbols, and redundant dependency tag symbols.

[0056] Label the dependency type tags for each directed edge to more clearly show the dependency relationship and dependency type between functional modules.

[0057] The dependency type tag is text or a symbol attached to the directed edge, used to indicate the dependency type of the edge.

[0058] For a strong dependency edge, "strong dependency" can be labeled or a symbol for strong dependency (such as a solid arrow) can be used;

[0059] For a weak dependency edge, "weak dependency" can be labeled or a symbol for weak dependency (such as a hollow arrow) can be used;

[0060] For a redundant dependency edge, "redundant dependency" can be labeled or a symbol for redundant dependency (such as a crossed arrow) can be used.

[0061] By labeling the dependency type tags for each directed edge, a complete dependency graph is generated. The dependency graph intuitively shows the dependency relationship and dependency type between each functional module.

[0062] In a specific embodiment: taking a library management system as an example:

[0063] Identify the functional modules in the system: User Management Module (UM), Book Entry Module (BM), Book Borrowing Module (LM), Book Return Module (RM).

[0064] Map each functional module to a node in the dependency graph and label the node identifier.

[0065] Analyze the dependency relationship between functional modules:

[0066] The Book Borrowing Module (LM) depends on the User Management Module (UM) for user authentication;

[0067] The Book Entry Module (BM) and the Book Return Module (RM) also depend on the User Management Module (UM) to obtain user information.

[0068] Generate directed edges according to the dependency direction and type: Generate a strong dependency edge (solid arrow) from LM to UM; Generate a weak dependency edge (dashed arrow) from BM and RM to UM respectively.

[0069] Assume that the Book Borrowing Module (LM) also depends on the book information provided by the Book Entry Module (BM), then generate a strong dependency edge (solid arrow) from LM to BM.

[0070] Label each directed edge with a dependency type label: Label "strong dependency" on the edge from LM to UM; Label "weak dependency" on the edges from BM and RM to UM.

[0071] Use a graph drawing tool to combine the nodes, directed edges, and dependency type labels to generate a complete dependency graph.

[0072] Step 4. Conduct complexity analysis on the dependency graph to calculate the coupling degree and dependency depth among multiple functional modules, and mark the modules to be processed; among them, the modules to be processed include highly coupled modules and highly dependent modules.

[0073] After generating the dependency graph, analyze it to evaluate the complexity of the system and identify the modules that require special attention.

[0074] Step 41. Determine any node, and based on the number of directed edges of any node in the dependency graph, determine the coupling degree of the functional module corresponding to any node.

[0075] First, select any node in the dependency graph as the analysis object. The node represents a functional module in the system, and the directed edges of the node represent the dependency relationships between this module and other modules.

[0076] To calculate the coupling degree of a node, count the number of directed edges connecting this node to other nodes in the dependency graph. The more the number of directed edges, the more complex the dependency relationship of this module with other modules, and the higher the coupling degree. For example, if a node has 5 directed edges connected to other nodes, then the coupling degree of the functional module corresponding to this node is 5.

[0077] Step 42. Determine any node, and count the number of edges from any node in the dependency graph to other nodes in the dependency graph. Take the number of the maximum number of edges as the dependency depth of the functional module corresponding to any node.

[0078] Analyze any node in the dependency graph to calculate the dependency depth of its corresponding functional module. The dependency depth reflects the level and complexity of the module in the dependency relationship, that is, how many layers of other modules a module depends on to complete its function.

[0079] To calculate the dependency depth of a node, starting from this node, traverse the dependency graph along the directed edges and count the number of edges on the longest path from this node to other nodes. The number of edges on this longest path is the dependency depth of this node. For example, if a node can reach the bottom - layer module through three - layer dependencies, then the dependency depth of the functional module corresponding to this node is 3.

[0080] The dependency depth is an important indicator to measure the dependency level and complexity of a module. A high dependency depth means that the function implementation of a module depends on multiple layers of other modules, which increases the complexity and vulnerability of the system because the modification of the bottom - layer module may affect the functions of multiple upper - layer modules.

[0081] Step 43: Determine the coupling degree threshold and the dependency degree threshold, and mark the nodes with a coupling degree greater than the coupling degree threshold as high - coupling modules, and mark the nodes with a dependency degree greater than the dependency degree threshold as high - dependency modules.

[0082] According to the specific situation and requirements, determine the coupling degree threshold and the dependency degree threshold. These two thresholds are the criteria for judging whether a module belongs to high - coupling or high - dependency.

[0083] The coupling degree threshold can be set according to the average coupling degree between modules in the system or empirical values. If the coupling degree of a certain module exceeds the coupling degree threshold, then mark this module as a high - coupling module.

[0084] The dependency degree threshold can be set according to the average dependency depth of modules in the system or the hierarchical structure of the system. If the dependency depth of a certain module exceeds the dependency degree threshold, then mark this module as a high - dependency module.

[0085] In the embodiments of this application, both the coupling degree threshold and the dependency degree threshold are set manually.

[0086] In a specific example: taking a library management system as an example, perform a complexity analysis on the dependency graph according to the above steps.

[0087] Nodes: User Management Module (UM), Book Input Module (BM), Book Borrowing Module (LM), Book Returning Module (RM), Report Generation Module (RMG).

[0088] Directed edges: UM → BM (The User Management Module provides user information for the Book Entry Module), UM → LM (The User Management Module provides user authentication for the Book Borrowing Module), UM → RM (The User Management Module provides user information for the Book Return Module), BM → LM (The Book Entry Module provides book information for the Book Borrowing Module), LM → RMG (The Book Borrowing Module provides borrowing data for the Report Generation Module).

[0089] Coupling degree calculation:

[0090] UM node: There are 3 directed edges (UM → BM, UM → LM, UM → RM), and the coupling degree is 3.

[0091] BM node: There is 1 directed edge (BM → LM), and the coupling degree is 1.

[0092] LM node: There are 2 directed edges (LM → RMG, and the dependency received from UM), but only the edge with LM as the source point is considered here, that is, LM → RMG, and the coupling degree is 1 (if all connected edges are considered, additional definitions or explanations are required).

[0093] RM node: There is no out-edge, and the coupling degree is 0.

[0094] RMG node: There is no out-edge, and the coupling degree is 0.

[0095] Dependency depth calculation:

[0096] UM node: The longest path is UM → LM (or UM → BM / RM), and the dependency depth is 1.

[0097] BM node: The longest path is BM → LM, and the dependency depth is 1.

[0098] LM node: The longest path is LM → RMG, and the dependency depth is 1.

[0099] RM node: There is no dependency path, and the dependency depth is 0.

[0100] RMG node: There is no dependency path (only as the end point), and the dependency depth is 0 (if considering that its data comes from LM, it can be regarded as a special case with a dependency depth of 1).

[0101] Threshold setting and module marking:

[0102] Set the coupling degree threshold to 2, then the UM node is marked as a high-coupling module.

[0103] Set the dependency degree threshold to 1, then all modules with dependency relationships (UM, BM, LM) are not additionally marked as high-dependency.

[0104] Step 5. Process the modules to be processed based on the dependency graph and a preset dependency minimization strategy to determine the optimization paths for multiple modules to be processed; wherein, the optimization paths include decoupling optimization and redundancy elimination.

[0105] Optimize the modules to be processed through the dependency graph and a preset dependency minimization strategy to reduce the coupling degree between modules and eliminate redundant dependencies, thereby improving the maintainability, scalability, and performance of the system. The optimization paths mainly include two aspects: decoupling optimization and redundancy elimination.

[0106] Step 51. Based on the dependency relationship between the functional modules connected to the module to be processed and the module to be processed, determine the module parts to be stripped from the module to be processed to determine the first optimization path; wherein, the module parts to be stripped are the functions in the module to be processed that are dependent on by more than two functional modules connected to the module to be processed.

[0107] First, analyze the dependency relationship between the module to be processed and the functional modules connected to it. The module to be processed is a module marked due to high coupling degree or high dependency depth. Therefore, the module to be processed often undertakes multiple functions or serves multiple other modules.

[0108] To determine the module parts to be stripped, by identifying the functional parts that are dependent on by two or more functional modules connected to the module to be processed, the module parts to be stripped can be determined. The above-mentioned functional parts are usually the common parts or core parts in the module to be processed, and this functional part is shared and used by multiple other modules.

[0109] The first optimization path includes separating the module parts to be stripped from the module to be processed to form an independent module or component for better management and maintenance. Through decoupling optimization, the direct dependency relationship between the module to be processed and other modules can be reduced, the coupling degree of the system can be lowered, and the flexibility and maintainability of the system can be improved.

[0110] Step 52. Process the module to be processed based on a static analysis tool and preset detection rules to identify the dependency relationships of the module to be processed that are not actually called to determine the second optimization path.

[0111] First, a static analysis tool and preset detection rules will be used to further analyze the module to be processed. The static analysis tool can check and analyze the structure, syntax, and semantics of the code without running the code, thereby discovering potential problems and optimization points.

[0112] The preset detection rules include identifying dependency relationships that are not actually called, unused variables or functions, and duplicate code segments. By applying these rules, redundant dependencies and invalid code existing in the module to be processed can be identified, and then the second optimization path can be determined.

[0113] The second optimization path generally includes eliminating redundant dependencies, deleting unused code, merging duplicate code snippets, etc. Through redundancy elimination, the complexity and size of the system can be reduced, and the performance and maintainability of the system can be improved.

[0114] Step 53: Determine the optimization path based on the first optimization path and the second optimization path.

[0115] Combine the first optimization path and the second optimization path to determine the final optimization path.

[0116] In a specific embodiment, taking a library management system as an example:

[0117] The library management system includes a user management module, a book management module, a borrowing management module, and a report generation module. Through dependency graph analysis, it is found that the book management module has a high coupling degree with other modules because it undertakes multiple functions (book entry, book query, book update), and is marked as a module to be processed.

[0118] Analyze the dependency relationship between the book management module and the functional modules it is connected to (such as the borrowing management module and the report generation module).

[0119] Identify the book query function that is commonly dependent on by the borrowing management module and the report generation module.

[0120] Separate the book query function from the book management module to form an independent query module.

[0121] Update the dependency graph to reflect the module structure after decoupling optimization.

[0122] Use a static analysis tool to perform code analysis on the book management module.

[0123] Apply the preset detection rules to identify the book update function that is not actually called (assuming that this function is not used in the current system).

[0124] Delete the code of the unused book update function.

[0125] Update the dependency graph to reflect the module structure after redundancy elimination.

[0126] Combine the first optimization path and the second optimization path to determine the final optimization path.

[0127] Step 6: Refactor the initial code based on the optimization path, adjust the call relationship between multiple functional modules, and generate optimized code.

[0128] After completing the analysis of the dependency graph and determining the optimization path, the initial code is refactored to actually implement these optimizations. Through the previously determined optimization path, the call relationships between functional modules are adjusted to generate more efficient and maintainable optimized code.

[0129] Step 61: Extract the code related to the module to be stripped from the module to be processed to generate an independent functional module, and update the connection relationships in the dependency graph to generate the first optimized dependency graph.

[0130] Encapsulate the independent functional module; among them, the independent encapsulation module includes interfaces for other modules to call the encapsulated functional module.

[0131] According to the first optimization path determined in step 5, identify the module to be stripped in the module to be processed.

[0132] Extract the code related to the module to be stripped from the module to be processed to form a new and independent functional module. This independent module will be specifically responsible for the part of the function originally undertaken by the module to be processed.

[0133] In the dependency graph, change the dependency relationship related to the module to be stripped that originally pointed to the module to be processed to point to the newly generated independent functional module.

[0134] Update the connection relationships in the dependency graph to ensure that all dependency relationships correctly reflect the actual call relationships between modules.

[0135] Encapsulate the newly generated independent functional module and provide interfaces for other modules to call.

[0136] In the example of this step:

[0137] In the library management system, the module to be processed is the "library management module", and the module to be stripped is the "book query function".

[0138] Extract the book query function from the library management module to form an independent "book query module".

[0139] Update the dependency graph, and change the book query dependency relationship that originally pointed to the library management module to point to the book query module.

[0140] Encapsulate the book query module and provide interfaces such as searchBook(bookId) for other modules to call.

[0141] Step 62: Remove the dependency code corresponding to the second optimization path in the module to be processed, and update the dependency graph to delete the directed edges and dependency type labels associated with the second optimization path in the first optimized dependency graph, generating the second optimized dependency graph.

[0142] Identify the code corresponding to the dependency relationships that are not actually called in the module to be processed, according to the second optimization path determined in step 5.

[0143] Remove these redundant dependency codes to reduce the complexity of the system and improve performance.

[0144] In the first optimized dependency graph, delete the directed edges and dependency type labels associated with the second optimization path.

[0145] In the example of this step:

[0146] In the library management system, the second optimization path indicates that the "book update function" in the "book management module" is not actually called.

[0147] Remove the code of the book update function in the book management module.

[0148] Update the dependency graph, and delete the directed edges and dependency type labels related to the book update function.

[0149] Step 63: Process the second optimized dependency graph based on a static analysis tool to perform static analysis verification on the refactored code and generate a verification result.

[0150] Use a static analysis tool to perform static analysis on the refactored code.

[0151] The static analysis tool will generate a verification result, indicating possible problems or potential risks in the code.

[0152] Modify and optimize the code further according to the verification result.

[0153] Step 64: When the verification result is passed, output the optimized code.

[0154] When the verification result of the static analysis tool is passed, it means that the refactored code meets the requirements in terms of structure, syntax, semantics, etc.

[0155] Output the optimized code that has passed the verification as the final code file or code library. It can be understood that if the verification result is not passed, the programmer needs to make manual modifications or repeat steps 1 - 6.

[0156] In a specific embodiment, taking the library management system as an example:

[0157] The library management system includes a user management module, a book management module, a borrowing management module, and a report generation module. Through the analysis of the dependency graph and the determination of the optimization path, it is found that the book query function and the book update function in the book management module can be optimized.

[0158] Extract the book query function from the book management module to form an independent book query module.

[0159] Update the dependency graph, changing the book query dependency that originally pointed to the book management module to point to the book query module.

[0160] Encapsulate the book query module and provide interfaces such as searchBook(bookId) for other modules to call.

[0161] Remove the book update function code from the book management module because this function is not actually called in the current system.

[0162] Update the dependency graph and delete the directed edges and dependency type labels related to the book update function.

[0163] Use a static analysis tool to perform static analysis on the code of the refactored book management system.

[0164] Check for issues such as syntax errors, undefined variables, and unused code snippets in the code.

[0165] Generate verification results and make corresponding modifications and optimizations based on the results.

[0166] When the verification result of the static analysis tool is passed, output the optimized code of the book management system as the final code file.

[0167] This application also includes the following methods: constructing a module dependency health quantification model, and evaluating the coupling degree and dependency depth of the dependency graph, the first dependency graph, and the second dependency graph based on the module dependency health quantification model; processing the coupling degree and dependency depth based on a preset health weight to generate a health score.

[0168] In order to more comprehensively evaluate the dependency relationships of the functional modules of a software system, this application also proposes a module dependency health quantification model. This model provides an intuitive health score by quantifying the coupling degree and dependency depth between modules, thereby helping developers identify and optimize potential dependency problems.

[0169] First, construct a module dependency health quantification model.

[0170] It can be understood that the coupling degree and dependency depth are calculated according to the calculation method of this application and will not be elaborated here.

[0171] The health weight is a parameter used to balance the coupling degree and dependency depth in the health score.

[0172] According to specific requirements and constraints, the developer sets different health weights to reflect different attentions to the coupling degree and the depth of dependence.

[0173] Furthermore, evaluate the coupling degree and the depth of dependence of the dependency graph.

[0174] Use the constructed module dependency health quantification model to evaluate the initial dependency graph.

[0175] Calculate the coupling degree and the depth of dependence indicators for each functional module.

[0176] Evaluate the first dependency graph and the second dependency graph:

[0177] After optimizing the initial dependency graph, a first dependency graph (such as the dependency graph after step 61) and a second dependency graph (such as the dependency graph after step 62) are obtained.

[0178] Similarly, use the module dependency health quantification model to evaluate these two optimized dependency graphs and calculate the coupling degree and the depth of dependence indicators.

[0179] Furthermore, process the coupling degree and the depth of dependence based on the preset health weights to generate a health score

[0180] According to the preset health weights, perform a weighted sum of the coupling degree and the depth of dependence indicators to obtain the health score of each module.

[0181] The health score is a value between 0 and 100, where a higher score indicates a healthier module dependency relationship, and a lower score indicates potential dependency problems.

[0182] Analyze the calculated health scores to identify the functional modules with lower scores.

[0183] The above is the method embodiment proposed in this application. Based on the same inventive concept, the embodiment of this application also provides a low-code platform code optimization device based on dependency relationships, and its structure is as Figure 2 shown.

[0184] Figure 2 It is a schematic diagram of the internal structure of a low-code platform code optimization device based on dependency relationships provided by the embodiment of this application. As Figure 2 shown, the device includes:

[0185] At least one processor 201;

[0186] And a memory 202 communicatively connected to at least one processor;

[0187] Among them, the memory 202 stores instructions that can be executed by at least one processor. The instructions are executed by at least one processor 201, so that at least one processor 201 can:

[0188] Access a low-code platform to obtain initial code generated by the low-code platform; wherein, the initial code includes multiple functional modules, and each functional module includes code for at least one function; process the initial code based on a preset static code analysis tool to obtain the dependency relationships between the multiple functional modules; wherein, the dependency relationships include strong dependencies, weak dependencies, and redundant dependencies; generate a dependency graph based on the dependency relationships; wherein, the dependency graph includes multiple nodes and multiple edges, the nodes represent functional modules, and the edges represent the dependency relationships between functional modules; perform complexity analysis on the dependency graph to calculate the coupling degree and dependency depth between the multiple functional modules, and mark the modules to be processed; wherein, the modules to be processed include highly coupled modules and highly dependent modules; process the modules to be processed based on the dependency graph and a preset dependency minimization strategy to determine the optimization paths for the multiple modules to be processed; wherein, the optimization paths include decoupling optimization and redundancy elimination; reconstruct the initial code based on the optimization paths, adjust the call relationships between the multiple functional modules, and generate optimized code.

[0189] Some embodiments of the present application provide a Figure 1 non-volatile computer storage medium for optimizing low-code platform code based on dependency relationships, storing computer-executable instructions, and the computer-executable instructions are set to:

[0190] Access a low-code platform to obtain initial code generated by the low-code platform; wherein, the initial code includes multiple functional modules, and each functional module includes code for at least one function; process the initial code based on a preset static code analysis tool to obtain the dependency relationships between the multiple functional modules; wherein, the dependency relationships include strong dependencies, weak dependencies, and redundant dependencies; generate a dependency graph based on the dependency relationships; wherein, the dependency graph includes multiple nodes and multiple edges, the nodes represent functional modules, and the edges represent the dependency relationships between functional modules; perform complexity analysis on the dependency graph to calculate the coupling degree and dependency depth between the multiple functional modules, and mark the modules to be processed; wherein, the modules to be processed include highly coupled modules and highly dependent modules; process the modules to be processed based on the dependency graph and a preset dependency minimization strategy to determine the optimization paths for the multiple modules to be processed; wherein, the optimization paths include decoupling optimization and redundancy elimination; reconstruct the initial code based on the optimization paths, adjust the call relationships between the multiple functional modules, and generate optimized code.

[0191] Each embodiment in this application is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the Internet of Things devices and media, since they are basically similar to the method embodiments, the description is relatively simple, and reference can be made to the relevant parts of the method embodiments for the relevant content.

[0192] The systems and media provided by the embodiments of this application correspond one-to-one with the methods. Therefore, the systems and media also have beneficial technical effects similar to those of their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the systems and media will not be elaborated here.

[0193] Those skilled in the art should understand that the embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0194] This application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of this application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0195] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device that implements the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0196] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one process Figure 1 one process or multiple processes and / or blocks Figure 1 steps of the functions specified in one block or multiple blocks.

[0197] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.

[0198] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.

[0199] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can store information by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.

[0200] It is also noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device comprising a series of elements not only includes those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the existence of another identical element in the process, method, commodity or device comprising the element.

[0201] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.

Claims

1. A low-code platform code optimization method based on dependency, characterized in that: The method comprises: Accessing the low-code platform to obtain the initial code generated by the low-code platform; wherein the initial code includes multiple functional modules, each functional module includes the code of at least one function; Processing the initial code based on a preset static code analysis tool to obtain dependency relationships between the plurality of functional modules; wherein the dependency relationships include strong dependency, weak dependency and redundant dependency; Generate a dependency graph based on the dependency relationship; wherein the dependency graph includes a plurality of nodes and a plurality of edges, the nodes represent functional modules, and the edges represent dependency relationships between functional modules; Performing complexity analysis on the dependency graph to calculate the coupling degree and dependency depth between the plurality of functional modules, and marking the modules to be processed; wherein the modules to be processed include highly coupled modules and highly dependent modules; Processing the modules to be processed based on the dependency graph and a preset dependency minimization strategy to determine an optimization path for a plurality of the modules to be processed; wherein the optimization path includes decoupling optimization and redundancy elimination; The initial code is reconstructed based on the optimization path, and the calling relationship between the plurality of functional modules is adjusted to generate optimized code.

2. According to a dependency-based low-code platform code optimization method according to claim 1, it is characterized in that: Processing the initial code based on a preset static code analysis tool to obtain the dependency relationship between the plurality of functional modules specifically includes: Identify input relationships, output relationships, and call relationships between the functional modules based on the static code analysis tool; Construct a dependency matrix of input relationships, output relationships, call relationships, and dependency relationships; The input relationship, output relationship and call relationship are processed based on the dependency matrix to determine the dependency relationship between the plurality of functional modules.

3. According to a dependency-based low-code platform code optimization method according to claim 1, it is characterized in that: Generating a dependency graph based on the dependency specifically includes: Mapping the plurality of functional modules to a plurality of nodes in a dependency graph, wherein each node corresponds to a functional module; According to the dependency direction and dependency type of the dependency relationship, generate a plurality of directed edges to connect the plurality of nodes; Based on the dependency relationship, dependency type labels are labeled for the plurality of directed edges to generate a dependency graph; wherein the dependency type labels include a strong dependency label, a weak dependency label, and a redundant dependency label.

4. According to a dependency-based low-code platform code optimization method according to claim 1, it is characterized in that: Performing complexity analysis on the dependency graph to calculate the coupling degree and dependency depth between the plurality of functional modules and marking the modules to be processed, specifically including: Determine any node, based on the number of directed edges of any node in the dependency graph, to determine the coupling degree of the functional module corresponding to the any node; Determine any node, and count the number of edges from any node in the dependency graph to other nodes in the dependency graph, and take the number of the largest number of edges as the dependency depth of the functional module corresponding to any node; A coupling degree threshold and a dependency degree threshold are determined, and nodes with a coupling degree greater than the coupling degree threshold are marked as high-coupling modules, and nodes with a dependency degree greater than the dependency threshold are marked as high-dependency modules.

5. According to a dependency-based low-code platform code optimization method according to claim 1, it is characterized in that: Processing the modules to be processed based on the dependency graph and a preset dependency minimization strategy to determine optimization paths for the multiple modules to be processed, specifically including: Based on the dependency relationship between the functional modules connected to the module to be processed and the module to be processed, a module to be stripped from the module to be processed is determined to determine a first optimization path; wherein the module to be stripped is a function in the module to be processed that is dependent on two or more functional modules connected to the module to be processed; Processing the module to be processed based on the static analysis tool and the preset detection rule to identify the dependency of the module to be processed that is not actually called, so as to determine a second optimization path; The optimized path is determined based on the first optimized path and the second optimized path.

6. A method for optimizing low-code platform code based on dependency relationships according to claim 5, characterized in that: Reconstructing the initial code based on the optimization path and adjusting the calling relationship between the plurality of functional modules to generate optimized code specifically includes: Extracting the code related to the module to be stripped from the module to be processed to generate an independent functional module, and updating the connection relationship in the dependency graph to generate a first optimized dependency graph; Remove the dependency code corresponding to the second optimization path in the module to be processed, and update the dependency graph to delete the directed edges and dependency type labels associated with the second optimization path in the first optimization dependency graph, so as to generate a second optimization dependency graph; Processing the second optimized dependency graph based on the static analysis tool to perform static analysis verification on the reconstructed code to generate a verification result; When the verification result is that the verification is passed, the optimized code is output.

7. According to the dependency-based low-code platform code optimization method of claim 6, it is characterized in that: After extracting the code related to the module to be stripped from the module to be processed to generate an independent functional module, the method further includes: Encapsulate the independent functional module; wherein the independent encapsulated module includes an interface for calling by functional modules other than the encapsulated module.

8. A method for optimizing low-code platform code based on dependency relationships according to claim 6, characterized in that: The method further comprises: Constructing a module dependency health quantification model, and evaluating the coupling degree and dependency depth of the dependency graph, the first dependency graph, and the second dependency graph based on the module dependency health quantification model; The coupling degree and dependency depth are processed based on preset health weights to generate a health score.

9. A low-code platform code optimization device based on dependency, characterized in that: The device comprises: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to: Accessing the low-code platform to obtain the initial code generated by the low-code platform; wherein the initial code includes multiple functional modules, each functional module includes the code of at least one function; Processing the initial code based on a preset static code analysis tool to obtain dependency relationships between the plurality of functional modules; wherein the dependency relationships include strong dependency, weak dependency and redundant dependency; Generate a dependency graph based on the dependency relationship; wherein the dependency graph includes a plurality of nodes and a plurality of edges, the nodes represent functional modules, and the edges represent dependency relationships between functional modules; Performing complexity analysis on the dependency graph to calculate the coupling degree and dependency depth between the plurality of functional modules, and marking the modules to be processed; wherein the modules to be processed include highly coupled modules and highly dependent modules; Processing the modules to be processed based on the dependency graph and a preset dependency minimization strategy to determine an optimization path for a plurality of the modules to be processed; wherein the optimization path includes decoupling optimization and redundancy elimination; The initial code is reconstructed based on the optimization path, and the calling relationship between the plurality of functional modules is adjusted to generate optimized code.

10. A non-volatile computer storage medium for low-code platform code optimization based on dependency relationships, storing computer executable instructions, characterized in that: The computer executable instructions are configured to: Accessing the low-code platform to obtain the initial code generated by the low-code platform; wherein the initial code includes multiple functional modules, each functional module includes the code of at least one function; Processing the initial code based on a preset static code analysis tool to obtain dependency relationships between the plurality of functional modules; wherein the dependency relationships include strong dependency, weak dependency and redundant dependency; Generate a dependency graph based on the dependency relationship; wherein the dependency graph includes a plurality of nodes and a plurality of edges, the nodes represent functional modules, and the edges represent dependency relationships between functional modules; Performing complexity analysis on the dependency graph to calculate the coupling degree and dependency depth between the plurality of functional modules, and marking the modules to be processed; wherein the modules to be processed include highly coupled modules and highly dependent modules; Processing the modules to be processed based on the dependency graph and a preset dependency minimization strategy to determine an optimization path for a plurality of the modules to be processed; wherein the optimization path includes decoupling optimization and redundancy elimination; The initial code is reconstructed based on the optimization path, and the calling relationship between the plurality of functional modules is adjusted to generate optimized code.