A software development method and a software development system

By establishing a bidirectional and unique anchoring relationship between requirement semantic units and code AST nodes in software development, the problem of requirement and code disconnection is solved, enabling efficient and controllable requirement change management and ensuring code consistency and optimization retention.

CN122240067APending Publication Date: 2026-06-19YUETE INTELLIGENT TECHNOLOGY (XUZHOU) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
YUETE INTELLIGENT TECHNOLOGY (XUZHOU) CO LTD
Filing Date
2026-03-16
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

In software development, the lack of a machine-readable, syntactically precise, two-way traceability link between requirements and code makes it impossible to accurately locate requirement changes, resulting in high maintenance costs and uncontrollable change risks in the later stages of software projects. Furthermore, the full regeneration strategy of AI code generation tools leads to the loss of existing optimizations.

Method used

By pre-establishing a unique bidirectional anchoring relationship between requirement semantic units and code AST nodes, and persistently recording it in a bidirectional anchoring mapping table, the system can directly locate the affected AST nodes when requirements change, modify or regenerate only the relevant code areas, and perform dual verification of syntax and business logic.

Benefits of technology

It enables efficient and controllable modification of requirement changes, avoids the loss of existing optimizations caused by full regeneration, ensures that the scope of code modification is directly related to the changed requirements, and provides high-precision requirement-code consistency management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122240067A_ABST
    Figure CN122240067A_ABST
Patent Text Reader

Abstract

This invention discloses a software development method and system, relating to the field of software engineering technology. After precise code modification based on anchoring relationships, this invention performs a dual verification process: syntax correctness verification and business logic consistency verification. Syntax verification ensures that the modified code snippets themselves have no compilation errors or syntax violations. Business logic consistency verification compares and analyzes the business intent defined by the changed requirement semantic unit with the logic implemented in the affected code area after modification. This ensures that the added and modified logic will not have implicit conflicts or contradictions with other existing business rules in the system that are not directly anchored by this change, guaranteeing code adaptation for each instance. The result is not only syntactically correct but also semantically compatible and logically self-consistent in complex business contexts. While supporting high-frequency, fine-grained requirement changes, it maintains the overall consistency of the codebase.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software engineering technology, specifically to a software development method and a software development system. Background Technology

[0002] In current software development practices, a significant gap always exists between requirements management and code implementation. Although automation technologies, such as AI-assisted programming, can generate large amounts of code based on natural language descriptions, the relationship between requirements and code remains loose and indirect. Requirements are typically managed in the form of natural language documents or individual entries, while code exists as a separate symbolic system. The mapping between the two heavily relies on the developer's subjective understanding and manual maintenance. This separation is a major root cause of high maintenance costs and difficulty in controlling change risks in the later stages of software projects.

[0003] Existing technologies have significant shortcomings in handling requirement changes and code synchronization: When faced with changes in requirements, AI code generation tools often adopt a full regeneration strategy, which completely replaces the old code with the new requirements. This method is not only inefficient, but also ruthlessly overwrites the logic, specific algorithm implementations and performance tuning advantages that developers have manually optimized, resulting in the loss of knowledge assets.

[0004] When requirement changes cannot be accurately and automatically located to the specific code affected, developers need to manually compare the differences in requirements and then search for the parts that should be modified in the complex code library. This process is very easy to miss or make mistakes, resulting in an imperceptible deviation between the code implementation and the intended requirement, making it difficult to guarantee consistency.

[0005] The lack of a machine-readable, syntactically precise, two-way traceability link between requirement items and specific lines of code makes auditing, impact analysis, and root cause analysis of defects cumbersome, and makes it difficult to accurately assess the scope of any change's impact.

[0006] Therefore, there is an urgent need for a technical solution that can establish a fine-grained, dynamic, traceable, and strongly binding relationship between requirements and code from the bottom up, ensuring that every change in requirements can be automatically and accurately transmitted to the corresponding location in the code and synchronized in a verifiable way, while fully preserving all historical associations, thereby fundamentally solving the engineering problems caused by the disconnect between requirements and code. Summary of the Invention

[0007] The purpose of this invention is to overcome the shortcomings of existing technologies and provide a software development method and system. This system establishes a unique bidirectional anchoring relationship between requirement semantic units and code AST nodes in advance, and persistently records this relationship in a bidirectional anchoring mapping table. When requirements change, the system immediately identifies the affected specific requirement semantic units by parsing the changes and directly locates all specific AST nodes in the source code that are anchored to them by querying the bidirectional anchoring mapping table. The semantic adaptation module only modifies or regenerates the code areas corresponding to these anchored nodes and performs dual checks on the syntax and business logic of the new code. This mechanism ensures that the scope of code modification is limited to logical segments directly related to the changed requirements, without affecting the rest of the codebase. This avoids the loss of existing optimizations and knowledge gaps caused by full regeneration, making the change process highly controllable, efficient, and predictable.

[0008] To solve the above-mentioned technical problems, the present invention provides the following technical solution: On one hand, a software development method, the specific steps of which are as follows: S100. Parse the input original requirement description, decompose the original requirement description into multiple requirement semantic units with independent business semantics, assign a globally unique identifier to each requirement semantic unit, and store all the requirement semantic units in the requirement semantic unit library. S200. Based on the requirement semantic unit, generate initial source code, perform syntax parsing on the initial source code, generate a corresponding syntax tree, establish a bidirectional unique anchoring relationship between a specific AST node in the syntax tree and one or more requirement semantic units, and record the bidirectional unique anchoring relationship in a bidirectional anchoring mapping table. S300. When a requirement change text is received, the requirement text before and after the change is compared and semantically parsed to identify the target requirement semantic unit that has changed. Based on the bidirectional anchoring mapping table, the target AST node bound to the target requirement semantic unit is located. S400. Only for the source code region corresponding to the target AST node anchored to the target requirement semantic unit, perform code modification and regeneration, and perform syntax correctness verification and business logic consistency verification on the modified and regenerated code, update the bidirectional unique anchoring relationship between the AST node corresponding to the modified code region and the changed requirement semantic unit, and synchronously update the bidirectional anchoring mapping table. S500. Based on the updated bidirectional anchoring mapping table, automatically generate and maintain a requirement tracing chain from any requirement semantic unit to the anchored AST node, and a code tracing chain from any AST node back to the origin of the requirement semantic unit.

[0009] Furthermore, in step S100, decomposing the original requirement description into multiple requirement semantic units includes: The original requirement description is semantically analyzed using a natural language processing model to identify the business function description, which includes function points, input conditions, output results, and business rule elements. Each individual function point, along with its associated input conditions, output results, and business rule elements, is combined and encapsulated into a single requirement semantic unit.

[0010] Furthermore, in S200, the process of generating the initial source code and AST nodes based on the requirement semantic unit is as follows: Determine the priority order of code generation based on the functional points of the smallest unit of the requirements; Based on the semantic feature vector and input conditions of each requirement semantic unit, an independent code segment corresponding to the requirement semantic unit is generated. Each independent code segment has annotation anchors at the beginning and end that correspond to the globally unique identifier of the corresponding requirement semantic unit. All independent code fragments are spliced ​​and integrated according to the business rule elements of the aforementioned requirement semantic unit to generate complete initial source code; The initial source code is parsed using an Abstract Syntax Tree (AST) to generate a complete code syntax tree structure; Based on the annotation anchors of each independent initial source code fragment, and combined with the business dependencies of the requirement semantic unit, the complete code syntax tree is decomposed into multiple independent sub-syntax trees, each of which is the AST code node corresponding to the requirement semantic unit.

[0011] Furthermore, the bidirectional anchoring mapping table is a persistently stored data structure, and each record contains: a globally unique identifier field for the demand semantic unit, a source code file path field, and an AST node location identifier field; The bidirectional anchoring mapping table simultaneously establishes a forward index with the globally unique identifier of the demand semantic unit as the key and a reverse index with the combination of the source code file path and the AST node location identifier as the key, so as to perform bidirectional fast queries.

[0012] Furthermore, the construction process of the bidirectional unique anchor mapping table is as follows: Using the globally unique identifier of each requirement semantic unit as the primary key, construct the first dimension field of the bidirectional unique anchoring mapping table. The first dimension field includes requirement semantic text, semantic feature vector, business function description, and associated requirement semantic unit identifier. Using the globally unique identifier of each AST node as the primary key, a second dimension field of the bidirectional unique anchoring mapping table is constructed. The second dimension field includes code fragment content, code feature vector, syntax attribute information, and associated AST code node identifier. Based on the globally unique identifier of the same origin, establish the corresponding binding relationship between the first dimension field and the second dimension field, and generate the final bidirectional unique anchor mapping table; Configure bidirectional query permissions for the bidirectional unique anchor mapping table, allowing querying the full information of the corresponding AST code node through the globally unique identifier of the demand semantic unit, and simultaneously supporting querying the full information of the corresponding demand semantic unit through the globally unique identifier of the AST code node.

[0013] Furthermore, in step S300, the modified requirement text undergoes requirement decomposition and standardization processing to generate a modified set of requirement semantic units. The set of requirement semantic units before the modification and the set of requirement semantic units after the modification are then compared semantically for similarity. Where A is the text feature vector obtained after vectorization. The text feature vector In the B is the feature value in each dimension, and B is the text feature vector obtained after vectorization. For the text feature vector B in the th... Feature values ​​in each dimension The total dimension of the feature vectors. The value range is [0, 1]. The closer the value is to 1, the higher the business semantic consistency between the modified code snippet and the changed target requirement semantic unit. When the semantic similarity is higher... hour, If the preset semantic similarity threshold is met, then the two semantic units of demand are determined to be the same business unit with no content changes. When the change occurs, the modified requirement semantic unit is determined to be a unit whose content has been modified and is marked as a target requirement semantic unit. For the marked target requirement semantic unit, the bidirectional anchoring mapping table is traversed to match the target AST node bound to the globally unique identifier of the target requirement semantic unit.

[0014] Furthermore, in S400, the process of performing syntax correctness verification on the modified and regenerated code fragment is as follows: The modified code snippet is parsed to check for syntax errors, missing dependencies, variable conflicts, and type mismatches. If syntax errors, missing dependencies, variable conflicts, or type mismatches are found, the corresponding problem location information and syntax correction suggestions are generated and returned to the development side for modification until the modified code snippet is free of syntax errors. If no syntax errors, missing dependencies, variable conflicts, or type mismatches are found, the syntax compliance check is deemed to have passed, and the business semantic consistency check continues. The process of performing business logic consistency checks on the modified and regenerated code snippets is as follows: Perform code semantic encoding on the modified code snippet to generate a code semantic feature vector with the same dimension as the required semantic feature vector. ; The modified target requirement semantic unit is semantically encoded to generate the corresponding requirement semantic feature vector, denoted as vector. ; Calculate the business semantic matching degree between the code semantic feature vector and the requirement semantic feature vector. ,in, For vectors with vector cosine similarity, The business rule matching degree, with a value range of [0, 1], is calculated based on the coverage of business rules and constraints in the target requirement semantic unit according to the modified code snippet. A value of 1 is taken when there is complete coverage, and a value of 0 is taken when there is no coverage. This is the semantic similarity weight coefficient. Let be the weight coefficient for the matching degree of business rules, and satisfy α+β=1. The value range is [0, 1]. The closer the value is to 1, the higher the business semantic consistency between the modified code snippet and the changed target requirement semantic unit. The calculated business semantic matching degree The result is compared with a preset semantic matching threshold. hour, If the threshold value is set to the semantic matching degree, the business logic consistency check is considered to have passed; otherwise, the business logic consistency check fails.

[0015] Furthermore, in S500, when a requirement tracing request is received, the globally unique identifier of the requirement semantic unit to be traced is extracted through the requirement tracing chain, the updated bidirectional unique anchoring mapping table is traversed, and the AST node, code fragment content, code location information, code modification history, and full information of the verification record corresponding to the requirement semantic unit are queried. When a code tracing request is received, the globally unique identifier of the AST node to be traced is extracted through the code tracing chain. The updated bidirectional unique anchoring mapping table is traversed to query the full information of the requirement semantic unit, original requirement text, requirement change history, and business attribute information corresponding to the AST code node. Based on the updated bidirectional unique anchor mapping table, a requirement-code full-link traceability report is generated, which is used for development process auditing and compliance verification.

[0016] On the other hand, a software development system includes: The Requirement Semantic Unit Library module is used to parse and structure the input raw requirement description, generate and store requirement semantic units carrying globally unique identifiers; The code generation and parsing module is used to generate initial source code based on the requirement semantic units in the requirement semantic unit library module, and to perform syntax parsing on the source code to construct the corresponding syntax tree; The bidirectional anchoring module is used to establish and maintain a bidirectional unique anchoring relationship between the requirement semantic unit and the AST node in the syntax tree, persist the bidirectional unique anchoring relationship in the bidirectional anchoring mapping table, and when a requirement change information is received, query and locate the target AST node corresponding to the requirement semantic unit affected by the change according to the bidirectional anchoring mapping table. The semantic adaptation module is used to receive the location information of the target AST node, modify and regenerate the source code area corresponding to the target AST node, perform syntax verification and business logic consistency verification on the modified and regenerated code, and trigger the bidirectional anchoring module to update the anchoring relationship in the bidirectional anchoring mapping table after the verification passes. The traceability management module is used to dynamically generate and display the requirement traceability chain from the requirement semantic unit to the source code, and the code traceability chain from the source code back to the requirement semantic unit, based on the bidirectional anchoring mapping table.

[0017] Compared with existing technologies, this software development method has the following advantages: This invention establishes a unique bidirectional anchoring relationship between requirement semantic units and code AST nodes in advance and persists this relationship in a bidirectional anchoring mapping table. When a requirement changes, the system immediately identifies the affected specific requirement semantic units by parsing the changes and directly locates all specific AST nodes in the source code that are anchored to them by querying the bidirectional anchoring mapping table. The semantic adaptation module only modifies or regenerates the code areas corresponding to these anchored nodes and performs dual checks on the syntax and business logic of the new code. This mechanism ensures that the scope of code modification is limited to the logical segments directly related to the changed requirements, without affecting the rest of the codebase. This avoids the loss of existing optimizations and knowledge gaps caused by full regeneration, making the change process highly controllable, efficient, and predictable.

[0018] Other advantages, objectives and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination or study, or may be learned from the practice of the invention. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.

[0020] Figure 1 A flowchart illustrating the steps of a software development methodology; Figure 2 This is a flowchart illustrating the steps of constructing a bidirectional unique anchoring mapping table in an embodiment of the present invention; Figure 3 This is a block diagram of the modules of a software development system. Detailed Implementation

[0021] To better understand the above technical solutions, a detailed description of the solutions will be provided below in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0022] To address the engineering challenges in existing software development processes, such as the disconnect between requirements and code, the difficulty in accurately transmitting requirement changes to code implementation, and the loss of data due to manual optimization caused by AI-generated full code regeneration, this invention provides a software development method and system. This method pre-establishes a unique bidirectional anchoring relationship between requirement semantic units and abstract syntax tree (AST) nodes, persistently storing this relationship in a bidirectional anchoring mapping table. When requirements change, the affected code area can be accurately located, and only that local area is modified and regenerated. Simultaneously, the modified code undergoes dual verification of syntax and business logic, ultimately automatically maintaining a full-link traceability system that spans both requirements and code. This invention is applicable to various software development projects with high requirements for responsiveness to requirement changes and the need for refined management of requirement-code consistency, and is particularly suitable for the iterative development and maintenance of large and complex systems.

[0023] Specifically, in combination Figure 1 As shown, the software development method of the present invention achieves precise, traceable, and verifiable closed-loop management from requirements to code by establishing a fine-grained requirement-code anchoring and local code update mechanism. The specific steps of the method are as follows: S100. Parse the original requirement description of the input, decompose the original requirement description into multiple requirement semantic units with independent business semantics, assign a globally unique identifier to each requirement semantic unit, and store all requirement semantic units in the requirement semantic unit library. S200. Based on the requirement semantic unit, generate the initial source code, perform syntax parsing on the initial source code, generate the corresponding syntax tree, establish a bidirectional unique anchoring relationship between a specific AST node in the syntax tree and one or more requirement semantic units, and record the bidirectional unique anchoring relationship in the bidirectional anchoring mapping table. S300. When a requirement change text is received, the requirement text before and after the change is compared and semantically parsed to identify the target requirement semantic unit that has changed. Based on the bidirectional anchor mapping table, the target AST node bound to the target requirement semantic unit is located. S400: Modify and regenerate the code only for the source code region corresponding to the target AST node anchored to the target requirement semantic unit, and perform syntax correctness verification and business logic consistency verification on the modified and regenerated code. Update the bidirectional unique anchoring relationship between the AST node corresponding to the modified code region and the changed requirement semantic unit, and update the bidirectional anchoring mapping table synchronously. S500 automatically generates and maintains a requirement tracing chain from any requirement semantic unit to the anchored AST node, and a code tracing chain from any AST node back to the original requirement semantic unit, based on the updated bidirectional anchoring mapping table.

[0024] In the specific implementation process, the initial input is a raw requirement description in natural language, such as a product requirement document, user story, or use case description. This invention transforms unstructured text into machine-understandable and operable structured units using natural language processing (NLP) technology for deep analysis. Specifically, a pre-trained NLP model is used to perform semantic analysis on the raw requirement text, identifying various business function description elements, including: core functional points, input conditions, output results, business rules, and pre- and post-conditions.

[0025] Each identified independent functional point is taken as the core, and its closely related input conditions, output results, and business rules are combined and encapsulated into an indivisible requirement semantic unit with complete business semantics. Each generated requirement semantic unit is assigned a globally unique identifier to ensure its uniqueness and traceability within the system. All generated requirement semantic units with identifiers are ultimately persistently stored in a requirement semantic unit library.

[0026] The priority order of code generation is determined based on the business dependencies between semantic units of requirements. For each semantic unit of requirements, a preset code template or AI code generation model is called based on its semantic feature vector and explicit input conditions to generate a functionally independent code snippet corresponding to the unit. A special comment is automatically inserted at the beginning and end of each generated independent code snippet. This comment contains a globally unique identifier of its corresponding semantic unit of requirements, which serves as the physical anchor point between the code snippet and the requirement unit.

[0027] After all the independent code snippets have been generated, these code snippets with anchor comments are intelligently spliced ​​and integrated according to preset business rules and dependencies, and finally a complete, compileable and runnable initial source code is generated.

[0028] The initial source code is parsed to generate a standard structured abstract syntax tree (AST). Based on the inserted comment anchors, the system decomposes the syntax tree into multiple sub-syntax trees that correspond one-to-one with the semantic units of the requirements. The sub-syntax trees represent the AST code nodes that implement specific semantic units of the requirements. Thus, a fine-grained mapping from semantic units of requirements to AST nodes is fully established. The mapping relationship, along with the globally unique identifier of the semantic unit of requirements, the source code file path, the position identifier of the AST node in the syntax tree, etc., is stored as a record in the bidirectional anchoring mapping table, thereby completing the establishment of the bidirectional unique anchoring relationship.

[0029] When project requirements change, developers input the revised requirement text into the system. The system first performs the same processing flow as S100 on the revised requirement text, that is, performs requirement decomposition and standardization processing, and generates a new set of requirement semantic units that represent the revised requirements. At this time, it has the old set of semantic units before the change (from the requirement semantic unit library) and the new set of semantic units after the change.

[0030] To identify changes in the content of each requirement unit, a vector-based semantic similarity comparison algorithm is employed. The text content of each requirement semantic unit before and after the change is vectorized using an NLP model to obtain corresponding text feature vectors A and B. The cosine similarity and semantic similarity of text feature vectors A and B are then calculated. Where A is the text feature vector obtained after vectorization. The text feature vector In the B is the feature value in each dimension, and B is the text feature vector obtained after vectorization. For the text feature vector B in the th... Feature values ​​in each dimension The total dimension of the feature vectors. The value range is [0, 1]. The closer the value is to 1, the higher the business semantic consistency between the modified code snippet and the changed target requirement semantic unit.

[0031] The system presets a semantic similarity threshold. For the two semantic units of requirements before and after the change, when the calculated If the two units are essentially the same business unit and their content has not undergone substantial changes, then it is determined that they are not. Conversely, when... If the modified requirement semantic unit is determined to be a target requirement semantic unit whose content has been modified, after identifying all target requirement semantic units, the globally unique identifier is used as the key to traverse and query the persistent bidirectional anchor mapping table to locate all target AST nodes bound to it in the source code, including the file path where it is located and its specific location information in the AST.

[0032] After locating the affected target AST node, this invention operates only on the local source code region defined by anchor annotations corresponding to the target AST node, extracts the local code fragment, and, in conjunction with the description of the changed target requirement semantic unit, calls the code generation model again to regenerate only this code fragment.

[0033] The newly generated code snippet will replace the old code section in the source file, and double-checking will be performed on the newly modified code snippet: Syntax correctness verification: Perform independent syntax parsing on the modified code snippet to check for basic issues such as syntax errors, missing dependencies, variable conflicts, and type mismatches. If problems are found, generate a report containing problem location information and specific modification suggestions, and return it to the development team for intervention until the code snippet passes syntax verification.

[0034] Business logic consistency verification: After syntax verification, further verification is performed to confirm whether the code's implementation logic matches the changed requirements. This process is based on vectorization technology: the modified code snippets are semantically encoded to generate a code semantic feature vector with the same dimension as the requirement feature vector. The modified target requirement semantic units are semantically encoded to obtain the requirement semantic feature vector. Calculate the business semantic matching degree between the two. ,in, For vectors with vector cosine similarity, The business rule matching degree, with a value range of [0, 1], is calculated based on the coverage of business rules and constraints in the target requirement semantic unit according to the modified code snippet. A value of 1 is taken when there is complete coverage, and a value of 0 is taken when there is no coverage. This is the semantic similarity weight coefficient. Let be the weight coefficient for the matching degree of business rules, and satisfy α+β=1. The value range is [0, 1]. The closer the value is to 1, the higher the business semantic consistency between the modified code snippet and the changed target requirement semantic unit.

[0035] The calculated With preset semantic matching threshold When comparing, If the business logic consistency check passes, the business logic consistency check is considered successful; otherwise, the check fails, an alarm is triggered, and a manual review is requested.

[0036] Only after all syntax and business logic consistency checks pass are the modifications considered valid, officially merged into the main codebase, and the new AST node information in the code area updated. At the same time, a bidirectional unique anchoring relationship is automatically established between the new AST node and the changed semantic unit of the requirement, and the bidirectional anchoring mapping table is synchronously updated with the new record to overwrite the old mapping relationship, ensuring the real-time performance and accuracy of the mapping table.

[0037] Based on the bidirectional anchoring mapping table, this embodiment also provides end-to-end traceability capability. When a requirement tracing request is received, the globally unique identifier of the requirement semantic unit to be traced is extracted through the requirement tracing chain. By traversing the updated bidirectional anchoring mapping table, all detailed information corresponding to the requirement semantic unit can be queried and displayed, including: the anchored AST node identifier, the corresponding source code file, the specific code snippet content, the start and end line numbers of the code in the file, the history of code modifications, and the verification record of each modification.

[0038] When a code tracing request is received, the globally unique identifier of the AST node to be traced is extracted through the code tracing chain. Similarly, by traversing the bidirectional anchor mapping table, the source requirement semantic unit that generated the code can be queried and displayed, including: the original requirement text description, all historical versions of the requirement, and the business attribute information of the requirement.

[0039] Furthermore, based on the updated two-way anchoring mapping table, a requirement-code full-link traceability report is generated on demand, describing the complete mapping relationship between top-level business requirements and bottom-level code implementation, including traces of every change and verification results.

[0040] In a further embodiment of the present invention, the bidirectional anchoring mapping table is designed as a persistent and efficient data structure. Its core consists of mapping records, each containing: a globally unique identifier for the requirement semantic unit, a source code file path, and an AST node location identifier. This mapping table simultaneously constructs two types of indexes: a forward index using the globally unique identifier of the requirement semantic unit as the key, used to quickly locate code from the requirement; and a reverse index using the combination of the source code file path and the AST node location identifier as the key, used to quickly trace back from the code to the requirement. Specifically, as shown... Figure 2 As shown, the construction process of the bidirectional unique anchor mapping table of the present invention is as follows: Using the globally unique identifier of each requirement semantic unit as the primary key, the first dimension field is extended to record the requirement semantic text of the unit, the semantic feature vector used for similarity calculation, the business function description, and the identifiers of related requirement semantic units that have a dependency relationship with it. Using the globally unique identifier of each AST node as the primary key, a second dimension field is extended to record the code fragment content corresponding to the node, the code feature vector used for semantic matching, the syntactic attribute information of the node type, and the identifier of the associated AST code node with which it has a calling relationship. By using globally unique identifiers from the same source, the rich information of the first and second dimensions is bound together to form a complete mapping record, and bidirectional query permissions are configured for this mapping table. The full information of the corresponding AST node can be retrieved by identifying the semantic unit of the requirement, and the full information of the corresponding semantic unit of the requirement can also be retrieved by identifying the AST node, which is used for information retrieval and analysis during the development process.

[0041] On the other hand, the present invention also provides a software development system for implementing the above-mentioned control method, such as... Figure 3 As shown, the system includes: The Requirement Semantic Unit Library module is used to parse and structure the input raw requirement description, generate and store requirement semantic units carrying globally unique identifiers; The code generation and parsing module is used to generate initial source code based on the requirement semantic units in the requirement semantic unit library module, and to perform syntax parsing on the source code to construct the corresponding syntax tree; The bidirectional anchoring module is used to establish and maintain a bidirectional unique anchoring relationship between the requirement semantic unit and the AST node in the syntax tree, persist the bidirectional unique anchoring relationship in the bidirectional anchoring mapping table, and when a requirement change information is received, query and locate the target AST node corresponding to the requirement semantic unit affected by the change according to the bidirectional anchoring mapping table. The semantic adaptation module is used to receive the location information of the target AST node, modify and regenerate the source code area corresponding to the target AST node, perform syntax verification and business logic consistency verification on the modified and regenerated code, and trigger the bidirectional anchoring module to update the anchoring relationship in the bidirectional anchoring mapping table after the verification passes. The traceability management module is used to dynamically generate and display the requirement traceability chain from the requirement semantic unit to the source code, and the code traceability chain from the source code back to the requirement semantic unit, based on the bidirectional anchoring mapping table.

[0042] In summary, this invention fundamentally solves the technical challenge of long-term disconnect between requirements and code in software development by establishing a unique bidirectional anchoring relationship between requirement semantic units and code AST nodes, and persistently storing this relationship in a bidirectional anchoring mapping table. When requirements change, the system can accurately locate the affected local code area, enabling refined modifications and avoiding the loss of manual optimization results caused by traditional full regeneration. Simultaneously, through a dual verification mechanism of syntax and business logic, the correctness and consistency of the modified code with the requirements are ensured. The resulting requirement traceability chain and code source traceability chain provide end-to-end, verifiable, and transparent support for project management, change impact analysis, and compliance auditing, offering a high-precision and high-reliability solution for software engineering practices in highly dynamic environments.

[0043] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.

Claims

1. A software development method, characterized in that, The specific steps of this method are as follows: S100. Parse the input original requirement description, decompose the original requirement description into multiple requirement semantic units with independent business semantics, assign a globally unique identifier to each requirement semantic unit, and store all the requirement semantic units in the requirement semantic unit library. S200. Based on the requirement semantic unit, generate initial source code, perform syntax parsing on the initial source code, generate a corresponding syntax tree, establish a bidirectional unique anchoring relationship between a specific AST node in the syntax tree and one or more requirement semantic units, and record the bidirectional unique anchoring relationship in a bidirectional anchoring mapping table. S300. When a requirement change text is received, the requirement text before and after the change is compared and semantically parsed to identify the target requirement semantic unit that has changed. Based on the bidirectional anchoring mapping table, the target AST node bound to the target requirement semantic unit is located. S400. Only for the source code region corresponding to the target AST node anchored to the target requirement semantic unit, perform code modification and regeneration, and perform syntax correctness verification and business logic consistency verification on the modified and regenerated code, update the bidirectional unique anchoring relationship between the AST node corresponding to the modified code region and the changed requirement semantic unit, and synchronously update the bidirectional anchoring mapping table. S500. Based on the updated bidirectional anchoring mapping table, automatically generate and maintain a requirement tracing chain from any requirement semantic unit to the anchored AST node, and a code tracing chain from any AST node back to the origin of the requirement semantic unit.

2. The software development method according to claim 1, characterized in that, In step S100, decomposing the original requirement description into multiple requirement semantic units includes: The original requirement description is semantically analyzed using a natural language processing model to identify the business function description, which includes function points, input conditions, output results, and business rule elements. Each individual function point, along with its associated input conditions, output results, and business rule elements, is combined and encapsulated into a single requirement semantic unit.

3. The software development method according to claim 1, characterized in that, In step S200, the process of generating the initial source code and AST nodes based on the requirement semantic unit is as follows: Determine the priority order of code generation based on the functional points of the smallest unit of the requirements; Based on the semantic feature vector and input conditions of each requirement semantic unit, an independent code segment corresponding to the requirement semantic unit is generated. Each independent code segment has annotation anchors at the beginning and end that correspond to the globally unique identifier of the corresponding requirement semantic unit. All independent code fragments are spliced ​​and integrated according to the business rule elements of the aforementioned requirement semantic unit to generate complete initial source code; The initial source code is parsed using an Abstract Syntax Tree (AST) to generate a complete code syntax tree structure; Based on the annotation anchors of each independent initial source code fragment, and combined with the business dependencies of the requirement semantic unit, the complete code syntax tree is decomposed into multiple independent sub-syntax trees, each of which is the AST code node corresponding to the requirement semantic unit.

4. The software development method according to claim 1, characterized in that, The bidirectional anchoring mapping table is a persistently stored data structure, and each record contains: a globally unique identifier field for the demand semantic unit, a source code file path field, and an AST node location identifier field. The bidirectional anchoring mapping table simultaneously establishes a forward index with the globally unique identifier of the demand semantic unit as the key and a reverse index with the combination of the source code file path and the AST node location identifier as the key, so as to perform bidirectional fast queries.

5. The software development method according to claim 4, characterized in that, The construction process of the bidirectional unique anchor mapping table is as follows: Using the globally unique identifier of each requirement semantic unit as the primary key, construct the first dimension field of the bidirectional unique anchoring mapping table. The first dimension field includes requirement semantic text, semantic feature vector, business function description, and associated requirement semantic unit identifier. Using the globally unique identifier of each AST node as the primary key, a second dimension field of the bidirectional unique anchoring mapping table is constructed. The second dimension field includes code fragment content, code feature vector, syntax attribute information, and associated AST code node identifier. Based on the globally unique identifier of the same origin, establish the corresponding binding relationship between the first dimension field and the second dimension field, and generate the final bidirectional unique anchor mapping table; Configure bidirectional query permissions for the bidirectional unique anchor mapping table, allowing querying the full information of the corresponding AST code node through the globally unique identifier of the demand semantic unit, and simultaneously supporting querying the full information of the corresponding demand semantic unit through the globally unique identifier of the AST code node.

6. The software development method according to claim 1, characterized in that, In step S300, the modified requirement text undergoes requirement decomposition and standardization processing to generate a modified set of requirement semantic units. The semantic similarity is then compared between the original and modified sets of requirement semantic units. Where A is the text feature vector obtained after vectorization. The text feature vector In the B is the feature value in each dimension, and B is the text feature vector obtained after vectorization. For the text feature vector B in the th... Feature values ​​in each dimension The total dimension of the feature vectors. The value range of is [0, 1], when semantic similarity hour, If the preset semantic similarity threshold is met, then the two semantic units of demand are determined to be the same business unit with no content changes. When the change occurs, the modified requirement semantic unit is determined to be a unit whose content has been modified and is marked as a target requirement semantic unit. For the marked target requirement semantic unit, the bidirectional anchoring mapping table is traversed to match the target AST node bound to the globally unique identifier of the target requirement semantic unit.

7. The software development method according to claim 1, characterized in that, In S400, the process of performing business logic consistency verification on the modified and regenerated code fragments is as follows: Perform code semantic encoding on the modified code snippet to generate a code semantic feature vector with the same dimension as the required semantic feature vector. ; The modified target requirement semantic unit is semantically encoded to generate the corresponding requirement semantic feature vector, denoted as vector. ; Calculate the business semantic matching degree between the code semantic feature vector and the requirement semantic feature vector. ,in, For vectors with vector cosine similarity, This represents the business rule matching degree, with a value range of [0, 1]. This is the semantic similarity weight coefficient. Let α be the weight coefficient for the matching degree of the business rules, and satisfy α + β = 1. The value range is [0, 1]; The calculated business semantic matching degree The result is compared with a preset semantic matching threshold. hour, If the threshold value is set to the semantic matching degree, the business logic consistency check is considered to have passed; otherwise, the business logic consistency check fails.

8. The software development method according to claim 1, characterized in that, In S500, when a requirement tracing request is received, the globally unique identifier of the requirement semantic unit to be traced is extracted through the requirement tracing chain, the updated bidirectional unique anchoring mapping table is traversed, and the AST node, code fragment content, code location information, code modification history, and full information of the verification record corresponding to the requirement semantic unit are queried. When a code tracing request is received, the globally unique identifier of the AST node to be traced is extracted through the code tracing chain. The updated bidirectional unique anchoring mapping table is traversed to query the full information of the requirement semantic unit, original requirement text, requirement change history, and business attribute information corresponding to the AST code node. Based on the updated bidirectional unique anchor mapping table, a requirement-code full-link traceability report is generated, which is used for development process auditing and compliance verification.

9. A software development system, applicable to the software development method according to any one of claims 1-8, characterized in that, The system includes: The Requirement Semantic Unit Library module is used to parse and structure the input raw requirement description, generate and store requirement semantic units carrying globally unique identifiers; The code generation and parsing module is used to generate initial source code based on the requirement semantic units in the requirement semantic unit library module, and to perform syntax parsing on the source code to construct the corresponding syntax tree; The bidirectional anchoring module is used to establish and maintain a bidirectional unique anchoring relationship between the requirement semantic unit and the AST node in the syntax tree, persist the bidirectional unique anchoring relationship in the bidirectional anchoring mapping table, and when a requirement change information is received, query and locate the target AST node corresponding to the requirement semantic unit affected by the change according to the bidirectional anchoring mapping table. The semantic adaptation module is used to receive the location information of the target AST node, modify and regenerate the source code area corresponding to the target AST node, perform syntax verification and business logic consistency verification on the modified and regenerated code, and trigger the bidirectional anchoring module to update the anchoring relationship in the bidirectional anchoring mapping table after the verification passes. The traceability management module is used to dynamically generate and display the requirement traceability chain from the requirement semantic unit to the source code, and the code traceability chain from the source code back to the requirement semantic unit, based on the bidirectional anchoring mapping table.